>It was the stackmark that _really_ annoyed me. The fact that the vestor
>version was different just rubbed it in. I think it's gross to have
>such a thing as a genuine item that gets popped off the stack. I'd
>rather have something that was transparent to popping. Then the
>semantics of % .. % would be something like "collect together
>everything that is put on the stack as a result of doing this
>and put it into the appropriate structure".
Yes, it would be easy (and more consistent) for [% ... %] to be
implemented in the same way as {% ... %}, i.e.
{% <code> %}
being equivalent to
consvector(#| <code> |#)
which is itself equivalent to
lvars temp = stacklength();
<code>
consvector(stacklength() - temp);
(and similarly using -conslist- for [% ... %]).
However, this wouldn't make
[a], {% hd() %}
return {a}, because the stacklength *isn't increased* by the call of
-hd-, which is why the result of the expression is an empty vector. And
unless you save the entire stack before doing {% ... %}, there's no way
of telling afterwards that <code> has altered the top item on the stack.
John.
|