lua-users home
lua-l archive

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


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