lua-users home
lua-l archive

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



On Wed, Jun 11, 2014 at 10:09 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
A while is not a pure sugar for a
construction with gotos because of 'break'. (Sometimes, we use the term
"syntactical sugar" more loosely, disregarding some corner cases like a
'break' in a 'while', but it is important to know the difference.)

I'd like to ask about this, but I don't wish to sound like I disagree.

'break' doesn't exist without loop structures like "while". To extend the metaphor, 'break' becomes fat that accumulates thanks to the existence of sugar. 

Am I understanding this correctly?

I believe that I understand and accept the conclusion, but find the component of "expressive power" to be critical:

http://en.wikipedia.org/wiki/Expressive_power

Without this part of the definition, it does become a race to assembly. With it, one can say that a language makes a certain trade off between expressive power and efficiency. Syntactic sugar would then be a term that is limited to features that do not greatly impact that equation, accepting the impact on the parser of a dynamic language. So you end up at the same spot: your / Wikipedia's example of C's "a[i]" and Lua's "foo:bar(args,...)".

I believe that this is the same conclusion but for different reasons?

-Andrew