We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.18.3 (compiled with Erlang/OTP 27)
any
defmodule A do; def unquote(:"foo-bar"), do: :ok; end error: invalid syntax in def :"foo-bar" └─ iex:20: A (module) ** (CompileError) iex: cannot compile module A (errors have been logged) (elixir 1.18.3) src/elixir_def.erl:149: :elixir_def.store_definition/5 iex:20: (module) (elixir 1.18.3) src/elixir_compiler.erl:77: :elixir_compiler.dispatch/4 (elixir 1.18.3) src/elixir_compiler.erl:52: :elixir_compiler.compile/4 (elixir 1.18.3) src/elixir_module.erl:454: :elixir_module.eval_form/7 (elixir 1.18.3) src/elixir_module.erl:156: :elixir_module.compile/7 iex:20: (file)
The version with params works as expected
defmodule A do; def unquote(:"foo-bar")(), do: :ok; end
The docs in https://hexdocs.pm/elixir/Kernel.SpecialForms.html#quote/2-binding-and-unquote-fragments does not state that it is forbidden The docs in https://hexdocs.pm/elixir/1.18.3/Kernel.html#def/2 encourage to use paramsless form in the first example
No crash or docs updated to mention that params are required on defs with unquote fragments
The text was updated successfully, but these errors were encountered:
I can update the docs to provide be a bit clearer though but the behaviour is expected as you are literally defining:
def :foo do end
Sorry, something went wrong.
7ca67e9
No branches or pull requests
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.18.3 (compiled with Erlang/OTP 27)
Operating system
any
Current behavior
The version with params works as expected
The docs in https://hexdocs.pm/elixir/Kernel.SpecialForms.html#quote/2-binding-and-unquote-fragments does not state that it is forbidden
The docs in https://hexdocs.pm/elixir/1.18.3/Kernel.html#def/2 encourage to use paramsless form in the first example
Expected behavior
No crash or docs updated to mention that params are required on defs with unquote fragments
The text was updated successfully, but these errors were encountered: