Let's go with this proposal then: <+>, <->, <*> and </> with the same
precedence as the math equivalents.



*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*

On Thu, May 17, 2018 at 2:27 PM, Stas Versilov <[email protected]>
wrote:

> For my application (and for Decimal also) the same precedence as
> traditional math would be the key success factor of the new operators.
>
> Lower precedence (as now for custom operators) would be counter-intuitive,
> cause hardly detectable errors in calculations
> and lead to excessive use of brackets, because a <+> b<*>c (or a + b<*>c,
> as in my case) would actually work like (a + b)<*>c, not like a + (b<*>c)
> ,
> as one would expect by default.
>
>
> On Thursday, May 17, 2018 at 3:37:25 PM UTC+4, José Valim wrote:
>>
>> It would but it is worth saying we are adding a new rule that we don't
>> have right now. Today all custom operators currently have the same
>> precedence:
>>
>> https://github.com/elixir-lang/elixir/blob/master/lib/elixir
>> /src/elixir_parser.yrl#L68
>>
>> *José Valimwww.plataformatec.com.br
>> <http://www.plataformatec.com.br/>Founder and Director of R&D*
>>
>> On Thu, May 17, 2018 at 1:26 PM, Michał Muskała <[email protected]>
>> wrote:
>>
>>> On 17 May 2018, 13:13 +0200, José Valim <[email protected]>, wrote:
>>>
>>> Michał, I think the issue with your proposed approach is precedence. <+>
>>> and <*> need to have different precedences and where should we put those
>>> operators compared to all others?
>>>
>>>
>>>
>>>
>>> That's a good point. What if we put them at the same level as the
>>> regular operators? Would that work?
>>>
>>> Michał.
>>>
>>> --
>>> 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/ms
>>> gid/elixir-lang-core/e0d11c85-087c-4bba-9f5e-f8f8f40c3a07%40Spark
>>> <https://groups.google.com/d/msgid/elixir-lang-core/e0d11c85-087c-4bba-9f5e-f8f8f40c3a07%40Spark?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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/f3fcbbbb-0f0f-40d8-8b8d-
> 3b87107962ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/f3fcbbbb-0f0f-40d8-8b8d-3b87107962ec%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGnRm4JgR_BqOYAi1hPhGAC1yRaQV7MTxf1Exa%2BeAM0x%2BScNLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to