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: anonymous
Subject: [Octave-bug-tracker] [bug #64705] VM machine executed script clear the content of a global pre-declared global variable
Date: Thu, 5 Oct 2023 01:01:30 -0400 (EDT)

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

Does not work fully and status should be reverted. 

Not working use case:

The global variables are defined in a script. Actually the script is just a
code snippet, which conveniently defines all global variables.
Via this code snippet the global variables can be accessed in all functions
using these global variables.


Snippet_GlobalVars.m

global x1;
global x2;
global x3;
global x4;


Example function accessing these globals

function ret = I_Use_Globals()
  run ("Snippet_GlobalVars.m");
  disp(x1);
  ret = x1
endfunction


then testing

__vm_enable__(0);
run ("Snippet_GlobalVars.m");
x1 = 1;
I_Use_Globals();

works find and displays x1 = 1.


__vm_enable__(1);
run ("Snippet_GlobalVars.m");
x1 = 1;
I_Use_Globals();

results in 

error: VM internal error: Trying to make unnamed symbol global
error: called from
    Snippet_GlobalVars at line 3 column 1
    run at line 93 column 5
    I_Use_Globals at line 2 column 3




Note: When instead of using the code snippet the global variables are declared
directly, it works without error.



    _______________________________________________________

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]