[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Proposal for a standard way of defining custom operators in Lua
- From: Mark Hamburg <mhamburg.ml@...>
- Date: Sun, 28 Jul 2013 10:26:11 -0400
On Jul 28, 2013, at 8:17 AM, Leo Romanoff <firstname.lastname@example.org> wrote:
> ----- Ursprüngliche Message -----
>> Von: Mark Hamburg <email@example.com>
>> An: Leo Romanoff <firstname.lastname@example.org>; Lua mailing list <email@example.com>
>> CC: Lua mailing list <firstname.lastname@example.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 <email@example.com> 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
> 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.