lua-users home
lua-l archive

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


> in the C language the a[i] notation is syntactic sugar for *(a + i)

Nitpicking here, but since this is a nitpicking discussion :-) put a bracket around for strict equivalence due to operator precedence. *(a + i)++ is not valid C while a[i]++ is.

To iterate back, a for loop can be immediately be translated to a while loop. Always has been long before Lua. I somehow got the idea that in early C days the for loop might even have been a preprocessor makro, that would explain its akward syntax that we only became so costumed to. However, I miss evidence for that claim.

For Lua at least the numeric for can be fully translated. The generic for mostly, it needs one additional local variable, a token that is not used as global in the loop body. 

Anyway, I think this whole discussion is more about the sake of discussing, I don't see it anybody helping getting anything done.

To root of it has been, why is there ipairs? that became where is there a for? etc. The proper answer, while Lua is non-bloating it never was radical minimalist.