Add Kernel.is_non_struct_map/1 guard#13534
Conversation
whatyouhide
left a comment
There was a problem hiding this comment.
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.
| 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.
Another idea is: Returns true if term is a map that is not a struct (…)
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 <[email protected]>
|
|
||
| > #### Structs are maps {: .info} | ||
| > | ||
| > Structs are also maps, and many of Elixir data structures are implemented |
There was a problem hiding this comment.
| > 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.
@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!
Implemented based on
is_struct/1.The second commit adds an admonition to

is_map/1to increase awareness: