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

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

[Octave-bug-tracker] [bug #58691] Variables cannot be set in a script ca


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #58691] Variables cannot be set in a script called by a nested function
Date: Fri, 3 Jul 2020 02:56:06 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?58691>

                 Summary: Variables cannot be set in a script called by a
nested function
                 Project: GNU Octave
            Submitted by: siko1056
            Submitted on: Fri 03 Jul 2020 08:56:04 AM CEST
                Category: Interpreter
                Severity: 1 - Wish
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Since bug #58686 was fixed, it became apparent, that variables cannot be set
in a script called by a nested function, i.e. a builtin test of Octave passed,
while it was not passing (false positive).

Example (from "scripts/test/nest") Matlab compatible:


% script_nest_script.m
x = 5;



% script_nest.m
function x = script_nest
  A (5)
  function A (n)
    if n <= 0
      script_nest_script;
    else
      A (n - 1);
    end%if
  end%function
end%function



% fcn_calls_script.m
function x = fcn_calls_script ()
  script_nest_script;
end%function


The desired output from Matlab R2020b is


>> script_nest

ans = 5

>> fcn_calls_script

ans = 5


but in Octave 6 and 7 (cset d5311ca8f945, 02 Jul 2020) the call to
"script_nest" does not assign the output variable "x" set inside
"script_nest_script".





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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