Re: [elixir-core:11714] [Proposal] Adding Access.find/1

2024-03-20 Thread 'oliver....@googlemail.com' via elixir-lang-core
Hello, Jose. Thank you. :) I was thinking about adding an Access.find!/1, but since there's no equivalent Enum.find!/2 I stopped thinking about it. But yes, in deep updates it might make more sense than in the Enum.find/2 case. Best regards, Oliver On Wednesday, March 20, 2024 at 12:44:08 PM

Re: [elixir-core:11712] [Proposal] Adding Access.find/1

2024-03-20 Thread José Valim
Thank you. It seems the major objection was "waiting for a use case". There is a question about: what happens if you try to update an element that does not exist. But the behaviour in the PR mirrors `at`. We may want to introduce `find!` in the future to mirror `at!` as well. On Wed, Mar 20,

Re: [elixir-core:11712] [Proposal] Adding Access.find/1

2024-03-20 Thread 'oliver....@googlemail.com' via elixir-lang-core
This is what I found: >From the original PR: https://github.com/elixir-lang/elixir/pull/6634 (this has a lengthy discussion on the merits). The original discussion about including both: https://groups.google.com/g/elixir-lang-core/c/LlZCz0iYgfc/m/5XLRvg8XAgAJ (not very detailed, discussion

Re: [elixir-core:11710] [Proposal] Adding Access.find/1

2024-03-20 Thread José Valim
Can you please provide a link to the previous discussions? I recall dealing with some complexities around finding and not finding elements as well. Thanks! On Wed, Mar 20, 2024 at 11:37 AM 'oliver@googlemail.com' via elixir-lang-core wrote: > Hello, okay I checked. > > Well, there was a

Re: [elixir-core:11708] [Proposal] Adding Access.find/1

2024-03-20 Thread Andrea Leopardi
Right now I’m a bit drowning in work but IIRC there already was a proposal for this, has anyone searched the mailing list? On Wed, Mar 20, 2024, at 12:17 AM, Jean Klingler wrote: > I like it. It would be to `Access.filter` what `Enum.find` is to > `Enum.filter`. > I think it would be a nice

Re: [elixir-core:11710] [Proposal] Adding Access.find/1

2024-03-20 Thread 'oliver....@googlemail.com' via elixir-lang-core
Hello, okay I checked. Well, there was a discussion 7 years ago when Access.filter/1 was introduced but Access.find/1 was not. Maybe opinions might have changed since then? When going into the PR from back then I find the reasoning not very strong on not merging Access.find/1 because "it

Re: [elixir-core:11715] Why no ternary expression?

2024-03-20 Thread 'oliver....@googlemail.com' via elixir-lang-core
&(&1) ... sigh. In the project where I work I generally argue against these constructs because it really reduces readability. There's a limit of special character the brain can process correctly in a row. (My personal opinion, though.) In general, two constructs are more common in our code: