octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64705] VM machine executed script clear the c


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #64705] VM machine executed script clear the content of a global pre-declared global variable
Date: Fri, 6 Oct 2023 12:33:06 -0400 (EDT)

Follow-up Comment #12, bug #64705 (project octave):

The source() information complicates it a bit. I had been thinking that since
run.m calls evalin() and calling the script just by name goes to the
interpreter directly (as in not through evalin()), the problem might be
limited to calling evalin() from the VM. But source() is already in the
parse-tree code, so the problem likely isn't with evalin() in the VM, but in
scope contexts for variables.

IIUC when executing scripts, the VM creates a fictitious function that wraps
the script in a new context / scope, then when execution is finished it copies
those (local) variables back to the scope of the calling location (usually the
top level scope, but not necessarily), and deletes the fictitious function
that it created at the start. When executing scripts without the VM, that kind
of two-level scope and copying isn't done, and all script-local variables are
directly in the calling scope (almost always the top level scope), if I've
understood the scope correctly. Evidently this difference is causing some
scope-related errors like "non-existent variable foo".

@Petter: Do you think it'll help if the VM can be enabled for functions and
scripts independently of each other?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64705>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]