lua-users home
lua-l archive

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



On Wed, Jun 11, 2014 at 8:44 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
Wikipedia's page on that seems suitable:
        http://en.wikipedia.org/wiki/Syntactic_sugar

Yes.

> Specifically, a construct in a language is called syntactic sugar if it can be removed from the language without any effect on what the language can do: functionality and expressive power will remain the same. For instance, in the C language the a[i] notation is syntactic sugar for *(a + i).[1]

That "functionality" would remain the same is sort of given. If that's all there is to it, then it becomes a sort of game where we end up being able to add, store and jump to memory locations. 

The *expressive power* portion of the definition is the part that I was reaching for. For example, the intent of  "i = i +1" could not be clearer. "++i" is shorter and sweeter for the programmer, but it is not clearer and it is not more expressive.

However, "for" loops express an iteration over a set of values, which is an _expression_ that is different than "do this block of code while this condition remains true" which is different than "goto this label."


-Andrew