-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite recursion in test programs #2
Comments
I noticed this too... It's because earlier &x pushed the function object onto stack, while now it just pushes a symbol and then 'follows' the symbol later, so no copying is involved. One way to fix this is to also have another prefix, like 'x for example, that pushes a function object onto the stack... But I think this makes things messier. What do you suggest? |
(closed issue by mistake - reopened it) |
I suggest that the interpreter handle this as a special case and make copies of function objects when function symbol assignment is encountered. This is pretty easily coded, and as a proof-of-concept, the patch below, which implements the idea, seems to work pretty
(Following this scheme, ns_parentAssign also has to be patched in a very similar way). (EDIT: rephrased first paragraph for clarity) |
Hi, this is to report that the following test programs --
reverseif.ns
namespace.ns,
have an infinite recursion problem.
For example, in "reverseif.ns":
&if &_if =
{ rot _if } &if = #The 'reversed if'.
"_if" and "if" point to the same
object, thus, the following:
{ rot _if } &if =
is self-referential, so its expansion
leads to infinite recursion.
The true problem seems to be
that the "if" object's contents don't
get copied to a new location proper
to "_if".
The text was updated successfully, but these errors were encountered: