lua-users home
lua-l archive

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


> 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
gotos).

(I also fail to see how closures could be sugar for objects, but this is
somewhat out of topic here.)

-- Roberto