Re: Constructive criticism
- Posted by Critic Mar 09, 2009
- 1047 views
Hmm, you would prefer:
#define STACKS stacks[stack]
No. Preprocessors are a bad idea for an IDE/debugger and thus for a language.
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.
Anyway, call a procedure in between and the optimization becomes invalid, because the procedure may modify "stacks[stack]". 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.
s[$-1] = s[$-2] s[$-2] = temp stacks[stack] = s -- COW
Say what? I see only an O(1) operation occuring here.
Me too.