-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add Kernel.is_non_struct_map/1 guard #13534
New issue
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
Conversation
whatyouhide
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no second commit 🙃
lib/elixir/lib/kernel.ex
Outdated
| end | ||
|
|
||
| @doc """ | ||
| Returns `true` if `term` is a non-struct map; otherwise returns `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Returns `true` if `term` is a non-struct map; otherwise returns `false`. | |
| Returns `true` if `term` is a non-struct map, otherwise returns `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another idea is: Returns true if term is a map that is not a struct (…)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f88eda4 to
3c0fb46
Compare
😅 Pushed 3c0fb46 |
|
Today this can be achieved with |
Correct, this is how you have to achieve it right now. |
Co-authored-by: José Valim <jose.valim@gmail.com>
| > #### Structs are maps {: .info} | ||
| > | ||
| > Structs are also maps, and many of Elixir data structures are implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| > Structs are also maps, and many of Elixir data structures are implemented | |
| > Structs are also maps, and many of Elixir's data structures are implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vanderhoop I quickly grepped the codebase and seems we've been using Elixir data structures in other places so will keep the consistency (or we should fix it elsewhere too). Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🚀
Implemented based on
is_struct/1.The second commit adds an admonition to

is_map/1to increase awareness: