[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Proposal for a standard way of defining custom operators in Lua
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Thu, 25 Jul 2013 15:02:48 +0200
On 25/07/2013 14.03, steve donovan wrote:
On Thu, Jul 25, 2013 at 1:51 PM, Lorenzo Donati
<email@example.com <mailto:firstname.lastname@example.org>> wrote:
Yes, choosing good names is more an art than a science, but choosing
good symbols sometimes is akin to witchcraft!
Oh yes! Where overloading does make sense is implementing generalized
arithemetic operations (e.g. classic 'operations on a field' + - * / ^
with corresponding 'zero' and 'one' meanings) and there we have all the
operators we need.
Yes, really what I also had in mind.
A (great) exception is LPeg which uses operators to create a powerful
Although I know LPeg only superficially (yet - I hope ;-), still its
notation mimicks strongly those already established in the CS field (if
I'm not mistaken), so this wouldn't contradict my point: operator
overloading is great when you already know an operational notation and
the underlying semantics (fields operation, EBNF, etc.)
Even in C++, the standard library makes very sparing use of operator
overloading, + for strings, << & >> for stream reading/writing,  for maps.
I agree with Lorenzo that otherwise an impressive string of symbols is
an attempt to make 'code' (source) look like 'code' (a secret cipher).
Not a good fit for a DSL intended for non-professional programmers!
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments