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

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

[Octave-bug-tracker] [bug #53405] eval cannot create variables inside "l


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #53405] eval cannot create variables inside "local functions"
Date: Wed, 21 Mar 2018 11:33:37 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?53405>

                 Summary: eval cannot create variables inside "local
functions"
                 Project: GNU Octave
            Submitted by: siko1056
            Submitted on: Wed 21 Mar 2018 04:33:35 PM CET
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Regression
                  Status: Ready For Test
             Assigned to: siko1056
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

With the fix of bug #51698 the creation of variables inside "local functions"
(sometimes called "subfunction" not to be confused with "nested functions"
[1]) is no longer possible due to a static workspace marking.

Assume the following function file "local_function_eval.m":


function x = local_function_eval ()
  eval ("y = 5; x = y;");  # works
  x = local_fcn ("y = 6; x = y;");
endfunction

function x = local_fcn (expr)
  eval (expr);  # No longer works since 4.3.0+
endfunction


In Octave 4.2.2 and before this was allowed as in Matlab R2017b and before.

There are some ways to get around this, but I find it a legitimate usage (in
contrast to "nested functions", see bug #51698).

The changeset was http://hg.savannah.gnu.org/hgweb/octave/rev/4b0e0cae49db but
nowadays some files have changed (for example symscope.cc).

Is there a way to better distinguish between local and nested functions in
symscope.cc than in my attached patch?

[1] https://octave.org/doc/interpreter/Nested-Functions.html



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 21 Mar 2018 04:33:35 PM CET  Name: bug24942.patch  Size: 4KiB   By:
siko1056

<http://savannah.gnu.org/bugs/download.php?file_id=43617>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53405>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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