Re: [elixir-core:11236] [Proposal] Add macro is_real_map

2023-01-03 Thread 'Andrey Yugai' via elixir-lang-core
There's also an option of pattern matching any struct, not exactly a guard, but changing your code a bit shouldn't be a problem ``` def foo(%_{} = _struct), do... def foo(map) when is_map(map), do... ``` Sent from Proton Mail mobile Original Message On 4 Jan 2023, 04:03, Ja

Re: [elixir-core:11236] [Proposal] Add macro is_real_map

2023-01-03 Thread Jay Rogov
Also note that there's is_map_key/2 guard that serves the same purpose when used as `is_map_key(arg, :__struct__)`, allowing only maps but not structures: https://hexdocs.pm/elixir/1.14.2/Kernel.html#is_map_key/2 On Thursday, 22 December 2022 at 4:22:30 pm UTC+1 halos...@gmail.com wrote: > I th