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.
Macro.underscore/1
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
1.16.2, OTP-26
Mac
Macro.underscore/1 takes as argument either an atom or a string:
@spec underscore(module() | atom() | String.t()) :: String.t() def underscore(atom_or_string)
Looking at the function definition, atom must be associated with module:
def underscore(atom) when is_atom(atom) do "Elixir." <> rest = Atom.to_string(atom) underscore(rest) end
We cannot therefore pass nil, which is also an atom after all:
nil
iex(1)> Macro.underscore(nil) ** (MatchError) no match of right hand side value: "nil" (elixir 1.13.0) lib/macro.ex:1840: Macro.underscore/1
Should atoms that are not associated with modules be supported somehow by Macro.underscore/1?
To be discussed
The text was updated successfully, but these errors were encountered:
A module is just an atom as well, :foo is a valid after all. So the spec is redundant, we need to fix it as well as the docs.
:foo
Sorry, something went wrong.
eb6231d
No branches or pull requests
Elixir and Erlang/OTP versions
1.16.2, OTP-26
Operating system
Mac
Current behavior
Macro.underscore/1
takes as argument either an atom or a string:Looking at the function definition, atom must be associated with module:
We cannot therefore pass
nil
, which is also an atom after all:Should atoms that are not associated with modules be supported somehow by
Macro.underscore/1
?Expected behavior
To be discussed
The text was updated successfully, but these errors were encountered: