There is a simple fix to this problem. Create a stack onto which you push a copy of the current dynamic variables that you want to keep just before you do the recursive call and restore those dynamic variables immediately after the recursive call finishes.
The best place for this code is in a wrapper for the recursive call of the interpreter, this wrapper is responsible for doing the timing. Of course if you want to do something similar for other aspects of the FriCAS system, this simple approach can quickly get out of hand. But that is a consequence of the use of the Common List dynamic environment. Mind you, as long as it is only affecting timing, this should remain simple. On Mon, Dec 11, 2023 at 12:19 PM Waldek Hebisch <[email protected]> wrote: > There is trouble with recusive calls to intepreter. Ralf reported > problem with use of 'systemCommand("read foo.input")', after > fixing part of it I got a hang. Earlier, doing > > s := "1 + 1" > interpret_block(s)$Lisp > > we got a hang. I now found the reason: recursive call to > intepreter mangles '$timedNameStack' (and other timing > variables) causing infinite loop in statisctics code. > I am not sure what is proper fix for this (more precisely, > how should we time recursive calls). The attached patch > works around infinite loop and fixes abort when doing 'read' > as system command. > > > -- > Waldek Hebisch > > -- > You received this message because you are subscribed to the Google Groups > "FriCAS - computer algebra system" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/fricas-devel/ZXZjgLsGX6dRcAN4%40fricas.org > . > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAEnaMTEh2YSw10PqTJb%3DR3x6TKd1GXMQqVU5qzkaCNosO3DPKg%40mail.gmail.com.
