lua-users home
lua-l archive

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


Am 20.07.2016 um 15:20 schröbte Dirk Laurie:
2016-07-20 15:09 GMT+02:00 steve donovan <steve.j.donovan@gmail.com>:

On Wed, Jul 20, 2016 at 2:54 PM, Egor Skriptunoff
<egor.skriptunoff@gmail.com> wrote:
Explicit function calls (for converting or for math operations) are too
boring to use.

Ah, but once you start collecting new special operators then
remembering a few function names becomes easy in comparison.
Especially when the use of these operators is rather specialized.

Suggestion: make the few special characters we have left
user-configurable. I.e. introduce metamethod names for !x,
x ? y etc even though no native type defines a default meaning
for them.

IMHO, operators only make code easier to read if you have an intuitive understanding about what the operator is supposed to do and how it relates to other operators in the same expression (e.g. regarding precedence). Otherwise it only makes things harder to parse (for computers and humans alike). I've recently started to look at the Lens library in Haskell which has over 100 operators, and I'd very much prefer normal functions. I think this is a typical example of code that is convenient to write when you are familiar with the library, but hell to read when you come back after a while of doing something else.

Philipp


[1]: https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/a-little-lens-starter-tutorial#actually-there-are-a-whole-lot-of-operators-in-lens---over-100