lua-users home
lua-l archive

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


On Thu, Feb 28, 2013 at 9:14 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> A lollipop is a kind of sugar that is specially designed to suck.

Nice definition, but I fail to find your examples so very sweet...

> This is only convenient if you write objects that have only one instance
> (in which case why bother?)  Otherwise you don't want the methods in
> the object among the instance-dependent fields; they should go into
> a method table accessed via the `__index` metamethod, which normally
> is not a function but simply the method table itself.

We all went through this, and it took a little getting. Nowadays
better to point a person at a prepackaged candy bar called 'class'  ;)
(E.g Microlight)

However, as the late great Grace Hopper said "Standards are wonderful,
they are so many to choose from"

Also, aversion to syntactical sugar should be situational;  if I'm
being interactive, then I like as much sugar as I can get. (Which is
why I've developed a fondness for Moonscript, especially as a REPL:
Sean's Y combinator example looks like this:

Y = (f) ->
  local g
  g =  (...) -> f g,...
  g


f =  Y (x) => if x < 2 then 1 else  x * self(x - 1)
print f 5

OK, not everyone's highly-sugared cup of tea (I put in the fat arrow as a tease)
)

steve d.