lua-users home
lua-l archive

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


----- 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. 

The part "easier to grasp" or "easier to understand" is of course very subjective at the beginning. Before it is established, people have different views on how  a notation for a specific domain should look like and what certain notation means for them. Sometimes different people assign different meaning to the same operators, which results in a lot of misunderstandings. And usually it takes a while between introducing a notation and getting it accepted by the mainstream. Sometimes it never happens and sometimes alternative notations win...

-Leo