[nem-en] list operations priorities

Ivan Lakhturov lakhturov at gmail.com
Sat Dec 23 00:43:26 CET 2006


Hello Kamil,

>man, i don't care, it's on you
>it's not that hard to stick another couple of brackets
- i mean, leave it as it is now, it's ok ;)



> I tried this change and there are a few breaking places in compiler
> code itself... :(

> They are like:
>   str + "aa" :: str_list

> and it seems like not that uncommon pattern. So I'm not as sure as
> before that we should really do this. In general + should not be used
> for lists as it is quite expansive (the same with + on strings
> though), so maybe we should not change its priority to better support
> lists than strings and numeric values?

> 2006/12/22, Kamil Skalski <kamil.skalski at gmail.com>:
>> >        foo :: foo_list + bar :: bar_list
>>
>> Right, I think it should parse as:
>>
>> foo :: (foo_list + (bar :: bar_list))
>>
>> so :: should have higher left priority than +'s right priority:
>> x + y :: z   --->    x + (y :: z)
>>
>> the opposite case does not make much difference, but a bit of
>> performance gain with
>> x :: y + z   --->  x :: (y + z)   being better than   (x :: y) + z
>>
>>
>> --
>> Kamil Skalski
>> http://nazgul.omega.pl
>>


regards, phantom




More information about the devel-en mailing list