Re: Constructive criticism
- Posted by jimcbrown (admin) Mar 09, 2009
- 1033 views
The parser (... thank you, I know what a parser is ...) sees that stacks[stack] isn't used again until its completely replaced, which means that its safe to change s without separating the change from stacks[stack]. So it is smart enough to optimize the copy away.
Where is this optimization in OpenEU's source code? I cannot find it.
I was simply trying to distinguish compile.e and emit.e from parser.e and scanner.e (since both parts are referred to as "the parser").
Anyway, call a procedure in between and the optimization becomes invalid, because the procedure may modify "stacks[stack]".
Correct. A potential optimization might be to follow the procedure through to make sure that it doesn't modify stacks[stack], but I think we're both headed toward the same conclusion: once you've done all the optimizations possible, you hit a situation that you can't optimize away and you need to be able to specifiy whether you intended to make a true independent copy or just a reference.
The problem here is EU's copy semantics where the programmer intended reference semantics. That's what I meant: EU needs references just like any other language.
Agreed.