"/me really dislikes operators that do different things in different areas"

But that's exactly what happy makes the `=` operator do, and of all the 
operators in use `=` is by far the most used! `<-` effectively means "this 
is going to be bound according to the logic of the monad we're in". It 
isn't in common use outside of `for`, and `with` merely generalizes on that.

On Thursday, August 25, 2016 at 1:22:15 PM UTC-4, José Valim wrote:
>
>
> Testing, indeed it is not valid there.  :-)
>>
>> I wonder if it would be worth supporting such a case, I could report it 
>> in any case, done.  :-)
>>
>
> My point is that changing the AST is a slippery slope. I will likely 
> always find an example that fails because of precedence and mangling.
>
> Hmm, soft-matching operator, makes sense.  Any chance on updating the docs 
>> at 
>> http://elixir-lang.org/docs/stable/elixir/Kernel.SpecialForms.html#for/1 
>> where it states "Enumerable generators are defined using <-:" to 
>> something of that form, maybe like "`<-` matches on each given element and 
>> skips non-matches", although that still does not match how `with` does it.  
>> Hmm, it seems that `for` and `with` are using an identical operator in 
>> incompatible ways.
>>
>
> Improving the docs is a great idea. And again, the skipping or not is 
> defined by the enclosing with or for. All <- does is to check if something 
> matches. All you need to know is that the left side is a pattern.
>  
>
>> Hmm, having `when` be directly adjacent to `=` in precedence, what side 
>> effects would that have?  I do not think that `=` is allowed adjacent to a 
>> `when` that I can think of in function heads (which are the only other case 
>> where `when` is used that comes to immediate mind) so no issue there.
>>
>
> As mentioned in the previous email, it is related to the precedence of = 
> and when on the left side of ->. Play with the grammar and let us know if 
> you can make both "x when y = z" and "x = y when z -> w" work. Maybe if 
> both operators have the same precedence and are left associative?
>
>
>
> -- 
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
>

-- 
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/a931841b-df8e-4d78-8565-c245842a5c52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to