Question: Why a keyword 'foreach' if lua has a 'for ... in ... do ... end'?

Jun 16, 2014 at 2:45 PM
Edited Jun 16, 2014 at 6:38 PM
Question: Why a keyword 'foreach' if lua has a 'for ... in ... do ... end'?

Did you implemented and LL(1) parser and that is the reason?
Coordinator
Jun 16, 2014 at 7:31 PM
It was just for performance reasons, to avoid unnecessary function calls and casts, they are involved in the 'for in loop'.

I needed one time one look a head, but it should be a basically LL(1).

AND the IEnumerable pattern is a basic pattern of the framework, and so I thing it is good for developers to support this pattern more friendly. And it hopefully not hurts the lua language.
Jun 16, 2014 at 8:27 PM
Awesome...

I agree that it improves performance... I was a bit confused because of the extension, but is ok.

Just curious, did you implemented the lexer/parser by hand? or did you use the TinyPG, COCO/R or another tool like that?
Coordinator
Jun 16, 2014 at 8:42 PM
I did it by hand, because to write a parser is a nice straightforward process. It is not so complicated and you can shortcut and optimize some tasks. For example I also have no idea to say coco/r how to read the strings or comments.

Second I do not like the generated code.