I recently found the need for, and implemented, a version of `Access.all/0` that handles maps. The implementation is very similar to the one for lists, so I'm curious if anyone has any insight into why there's no built-in version for maps. If there's something I'm missing that makes it difficult to implement in a nice way that doesn't have weird corner cases, or if there just hasn't been a perceived need for it.I tried searching this mailing list and the Github repo but I wasn't able to spot anything related to "Access.all".
--
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 elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/88ae7e74-5bbb-4b3e-9eaf-cc1344a114e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I don't think there is anything that makes it hard to implement, except the conceptual issues that happen from such feature. If there are duplicate keys, which one wins? The other concern is that the Access API is also mostly specific to one data type, so we would need a new function for maps and I am not sure if it is worth it. It may be best to roll your own. :)
On Tue, Jun 25, 2019 at 6:26 PM Johanna Larsson <johanna....@gmail.com> wrote:
I recently found the need for, and implemented, a version of `Access.all/0` that handles maps. The implementation is very similar to the one for lists, so I'm curious if anyone has any insight into why there's no built-in version for maps. If there's something I'm missing that makes it difficult to implement in a nice way that doesn't have weird corner cases, or if there just hasn't been a perceived need for it.--I tried searching this mailing list and the Github repo but I wasn't able to spot anything related to "Access.all".
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 elixir-l...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/3598b84f-26a9-4430-b4c3-f449b4174f63%40googlegroups.com.
Re: duplicates. You could do something like "update_in [:foo, &all_map/3], ..." and that changes the keys in a way you have duplicate keys, which would be lot.The code snippet look neat though. I guess the more general version of it would be a traverse/3 function powered by a Traverse protocol that knows to enumerate and put things back together. Then it would be able to work with binaries, maps, lists, etc.José ValimSkype: jv.ptecFounder and Director of R&D
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/28d028b7-374f-487a-b141-6a2c39f4dff1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JFmQDEGTFEZor-MHNM8Qm6ABR4zL%3DvsfS6G3GmNdj%2BZg%40mail.gmail.com.