lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jul 28, 2013, at 8:17 AM, Leo Romanoff <romixlev@yahoo.com> wrote:

> ----- Ursprüngliche Message -----
> 
>> Von: Mark Hamburg <mhamburg.ml@gmail.com>
>> An: Leo Romanoff <romixlev@yahoo.com>; Lua mailing list <lua-l@lists.lua.org>
>> CC: Lua mailing list <lua-l@lists.lua.org>
>> Gesendet: 22:03 Samstag, 27.Juli 2013
>> Betreff: Re: Proposal for a standard way of defining custom operators in Lua
>> 
>> On Jul 24, 2013, at 11:33 AM, Leo Romanoff <romixlev@yahoo.com> wrote:
>> 
>>> dst <- msg1 <- msg2 <-msg3 vs send(send(send(dst, msg1), msg2), 
>> msg3)
>> 
>> But that could also be:
>> 
>> dst:send( msg1 )
>>     :send( msg2 )
>>     :send( msg3 )
>> 
> 
> 
> First of all, it was just an example. May be even not the best one.
> But sure, it could be like what you describe.
> 
> But according to your proposal also this
>  a + b - c
> could be
>  a: plus (b): minus (c) or 
>  minus(plus(a, b), c)
> right? :-) 
> 
> But we usually don't use it this way, or (unless you are a Smalltalker ;-)? As it was already said, operators can be always replaced by a normal function/method invocation syntax. Operators are just shortcuts, just a shorter notation. People tend to replace some well known and often used notations by something that is shorter to write and easier to grasp. 

Actually, when paranoid about space allocation, I have at times opted for the chained modifications method approach because it can avoid generating temporaries that the GC then needs to collect.

Mark