Good evening everybody.
This is a moved discussion from
https://github.com/elixir-lang/elixir/issues/5548#issuecomment-265602755.
Today, there's no way to work with structs in an easy way for the _in functions.
For static keys, everything is nice and shiny when working with both maps and
structs:
update_in(foo.bar.buz, &(...))
Unfortunately as soon as we need to introduce a dynamic value, it suddenly
becomes extremely clunky in case of structs:
update_in(foo.bar[key], &(...))
# vs
update_in(foo, [Access.key!(:bar), Access.key(key)], &(...))
This is generally pushing me to work more with unstructured data in forms of
maps, the usability difference is huge. The Access is a very powerful tool that
helps to solve many problems in a concise way, it's unfortunate structs have
such a poor support.
Michał.
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/4299E5C9-9C9B-411F-90FA-9EF7B6900327%40muskala.eu.
For more options, visit https://groups.google.com/d/optout.