[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?]
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 11 Jun 2014 09:47:27 -0300
> However, by the logic you're following, are closures sugar for objects? I'd
> think you'd say 'no', but then where do you draw the line?
> When something does exactly the same thing as something else, but in a less
> verbose (and usually more obfuscated) way, then it is sugar. Sugar is
> syntactic. That's why it's called "syntactic sugar"
Probably I am missing something, because I fail to see what in a
conventional switch statement (for a language like Lua) could be
different than sugar for a chain of if-elseif-else (unless you
are talking about "fall through", in which case you should use
(I also fail to see how closures could be sugar for objects, but this is
somewhat out of topic here.)