[nem-en] list operations priorities
Ivan Lakhturov
lakhturov at gmail.com
Sat Dec 23 00:25:37 CET 2006
Hello Kamil,
Friday, December 22, 2006, 11:42:46 PM, you wrote:
> 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
yeah, i know - using it on tiny lists
btw, how to insert an element to a list, say, into n-th position?
are the lists viewed as immutable?
> (the same with + on strings
> though), so maybe we should not change its priority to better support
> lists than strings and numeric values?
man, i don't care, it's on you
it's not that hard to stick another couple of brackets
just noticed this thing today and didn't hesitate to ask
lemme ask as well, can i set priorities for operators in my classes?
can i define 3-nary, 4-nary, so on operators?
(just wondering)
> 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