[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Proposal for a standard way of defining custom operators in Lua
- From: Leo Romanoff <romixlev@...>
- Date: Sun, 28 Jul 2013 05:17:04 -0700 (PDT)
----- Ursprüngliche Message -----
> Von: Mark Hamburg <firstname.lastname@example.org>
> An: Leo Romanoff <email@example.com>; Lua mailing list <firstname.lastname@example.org>
> CC: Lua mailing list <email@example.com>
> 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 <firstname.lastname@example.org> wrote:
>> dst <- msg1 <- msg2 <-msg3 vs send(send(send(dst, msg1), msg2),
> 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
a: plus (b): minus (c) or
minus(plus(a, b), c)
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...