lua-users home
lua-l archive

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



This proposal doesn't break anything (much?), and it does makes the code a bit shorter. I can't see how it makes anything clearer.

I admit, I'm unsure what to make of the type metatables idea.  I don't see a compelling argument for it -- but, maybe there's some important application that I'm missing. 

I do think there are plenty of situations where John's table shorthand will clarify the programmer's intent.  Unfortunately, it simultaneously obscures the function of the code.  Maybe it would be better executed as a parser hack, rather than a VM change.  For example, we could add some syntax sugar to convert:

for k,v : t do  ==> for k,v in pairs(t) do

Replacing the "in" token with something else would make it clear that we're not using the standard generic for syntax.  ":" is probably the best-looking existing token, though i suppose it might be mistaken by the reader as having something to do with method calls (from the parser's perspective, however, I don't think there'd be any confusion).

-Sven