Re: New EEP draft: Pinning operator ^ in patterns

zxq9 <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
On 2021/01/22 1:11, Kostis Sagonas wrote:
> On 1/21/21 3:41 PM, Richard Carlsson wrote:
>> Some weird code becomes obvious when annotated.
>>
>> What does this line do?
>>
>>      _ = [M = M:module_info(module) || M <- Needed],
>>
>> Oh, it's a multi-assertion!
>>
>>      _ = [^M = M:module_info(module) || M <- Needed],
> 
> I disagree.
> 
> This is _exactly_ the kind of code where you do *not* want such an 
> annotation.  You want to rewrite this to something like:
> 
>    true = lists:all(fun (M) -> M =:= M:module_info(module) end, Needed),
> 
> No matching is required here.
> 
> Kostis

+100

And further on this note, the entire example illustrates quite clearly 
why Erlangers don't want this.

"But I've been doing Elixir so much lately and..."

Yeah, that's Elixir. Stay over there. The paradigms do not converge.

How much harder does this have to be stated?

-Craig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.