[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal for a standard way of defining custom operators in Lua
- From: Duncan Cross <duncan.cross@...>
- Date: Wed, 24 Jul 2013 14:13:05 +0100
On Wed, Jul 24, 2013 at 10:53 AM, Leo Romanoff <romixlev@yahoo.com> wrote:
> Of course, using Metalua or some macro systems for Lua one could probably achieve the goal, but it sounds like an overkill for me.
>
> Therefore I was thinking about the following idea:
> - Introduce in Lua a standard mechanism to define a new operator.
I have the opposite view: using a third-party macro system is not the
"overkill" solution, introducing a feature in the language is. I just
don't see custom operators as such a massively useful thing across
many real usage domains to justify the added core complexity.
There is also the fact that Lua's expressions and statements are
strictly separated. You mention a "__send" operator - let's say this
operator is "<~", you would not be able to do "send_to_me <~ value;"
as a statement. You would have to do something like "local _ =
send_to_me <~ value;", assigning to a dummy variable to ignore the
final value of the operation.
-Duncan