iex(1)> map = %{a: %{b: %{c: 1}}}
%{a: %{b: %{c: 1}}}
iex(2)> pop_in(map.a.b[:c])
{1, %{a: %{b: %{}}}}
iex(3)> pop_in(map.a.b.c)
** (ArgumentError) cannot use pop_in when the last segment is a map/struct field.
This would effectively remove the field :c from the map/struct
Hi,
I would like to understand the rationale regarding this limitation. I understand that for structs, but as structs do not implement pop
by default an error would be thrown anyway.
But for maps, we can see that with the allowed syntax, the field was effectively removed from the map.
Thank you.