[Proposal] Add Access.get_lazy/3

58 views
Skip to first unread message

Tyler Young

unread,
Mar 8, 2022, 9:13:17 PM3/8/22
to elixir-lang-core
There's been advice in the community to avoid unnecessarily locking yourself into a particular data structure by using Access.get/2 rather the Map or Keyword versions of get/2.

In line with that, it would be nice if there were a corresponding Access.get_lazy/3. Obviously this wouldn't be available in the shorthand get syntax (my_container[:my_key]), but I think it'd be useful nonetheless.

José Valim

unread,
Mar 15, 2022, 7:54:06 AM3/15/22
to elixir-lang-core
That sounds OK to me, as we can implement it on top of Access.fetch. :) PR is welcome.

On Wed, Mar 9, 2022 at 3:13 AM Tyler Young <s3c...@gmail.com> wrote:
There's been advice in the community to avoid unnecessarily locking yourself into a particular data structure by using Access.get/2 rather the Map or Keyword versions of get/2.

In line with that, it would be nice if there were a corresponding Access.get_lazy/3. Obviously this wouldn't be available in the shorthand get syntax (my_container[:my_key]), but I think it'd be useful nonetheless.

--
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/50dae814-c49c-43e1-8447-6b4a35bfcf96n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages