We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
File http://elixir-lang.org/docs/master/elixir/Record.html
This does not compile:
defmodule User do Record.defrecord :user, [name: "José", age: "25"] end
produces this (some output removed to save space)
iex(1)> c("user.ex") == Compilation error on file user.ex == ** (CompileError) user.ex:2: you must require Record before invoking the macro Record.defrecord/2 (elixir) src/elixir_dispatch.erl:107: :elixir_dispatch.dispatch_require/6 (elixir) src/elixir.erl:196: :elixir.quoted_to_erl/3 (stdlib) erl_eval.erl:657: :erl_eval.do_apply/6 (elixir) src/elixir.erl:165: :elixir.erl_eval/2 (elixir) src/elixir.erl:165: :elixir.erl_eval/2
Once you add the require User, it compiles, but the example does not work:
require User
# To create records user() #=> {:user, "José", 25} user(age: 26) #=> {:user, "José", 26}
as shown here:
iex(2)> require User nil iex(3)> user() ** (RuntimeError) undefined function: user/0 iex(4)> user(age: 26) ** (RuntimeError) undefined function: user/1
The text was updated successfully, but these errors were encountered:
The docs are correct imo. It is fair to assume that the functions that we are describing will be imported or required.
Sorry, something went wrong.
It doesn't hurt to make the docs clearer. I will push a fix soon.
HI, I think the doc should also update this: record = User.user() -> {:user, "meg", "25"}
No branches or pull requests
File http://elixir-lang.org/docs/master/elixir/Record.html
This does not compile:
produces this (some output removed to save space)
Once you add the
require User
, it compiles, but the example does not work:as shown here:
The text was updated successfully, but these errors were encountered: