It’s only normally written in the context of an alias statement, like alias Foo.{Bar, Baz}.
Interestingly, the parser won’t let you write a function named {} explicitly, but one can be created by using a macro to build the AST:
defmodule WeirdMacro do
defmacro do_fun(name) do
{:def, [context: Elixir, import: Kernel],
[
{name, [context: Elixir],
[{:x, [if_undefined: :apply], Elixir}, {:y, [if_undefined: :apply], Elixir}]},
[
do: {{:., [], [{:__aliases__, [alias: false], [:IO]}, :inspect]}, [],
[
{{:x, [if_undefined: :apply], Elixir},
{:y, [if_undefined: :apply], Elixir}}
]}
]
]}
end
end
defmodule Foo do
require WeirdMacro
WeirdMacro.do_fun(:{})
end
Foo.{:arg1, :arg2}
I’m unsure when such a function would be useful - maybe in a complex DSL? - but it’s neat to see that it’s possible.






















