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

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

[Octave-bug-tracker] [bug #55523] Default argument of anonymous/nested f


From: anonymous
Subject: [Octave-bug-tracker] [bug #55523] Default argument of anonymous/nested function can't be assigned a variable with the same name
Date: Sun, 20 Jan 2019 03:25:09 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36 OPR/36.0.2130.80

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

                 Summary: Default argument of anonymous/nested function can't
be assigned a variable with the same name
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sun 20 Jan 2019 08:25:07 AM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Segfault, Bus Error, etc.
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.0
        Operating System: GNU/Linux

    _______________________________________________________

Details:

When a default argument of an anonymous handle function is assigned a variable
with the same name an error is shown. For example:



a = 1;
b = 2;

%Good
fb = @(a = b) a;
disp(fb());

%Error
fa = @(a = a) a;
disp(fa());



This behavior can be seen in nested functions:



function testfunction()

        a = 1;
        b = 2;
        
        function ret = fb(a = b)
                ret = a;
        end
        
        function ret = fa(a = a)
                ret = a;
        end
        
        disp(fb()); %Good
        disp(fa());     % error: 'a' undefined
        
end







    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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