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

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

[Octave-bug-tracker] [bug #57255] "+=" not parsed correctly in anonymous


From: Rik
Subject: [Octave-bug-tracker] [bug #57255] "+=" not parsed correctly in anonymous function within cell array context
Date: Tue, 19 Nov 2019 12:20:17 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #57255 (project octave):

                Priority:              5 - Normal => 2                      
                  Status:                    None => Confirmed              
                 Release:                   5.1.0 => dev                    
                 Summary: += operator behaves differently to manual increment
and ++ operator => "+=" not parsed correctly in anonymous function within cell
array context

    _______________________________________________________

Follow-up Comment #2:

Marking as confirmed, and changing the release to "dev" since this will have
to be fixed there.

For the original reporter, I would suggest moving up to the development code
where handles to nested functions are now supported.  The development branch
will become Octave version 6.1 near the end of 2019 / start of 2020 so waiting
might also be a possibility.

Incidentally, a bare '+=' fails 


octave:15> counter = @() x += 1 ;
error: parse error:

  syntax error

>>> counter = @() x += 1 ;


This seems to be because any variables which are not passed to the anonymous
function are substituted with their constant values at the time of the
anonymous function creation.  However, one can't substitute a constant for 'x'
in the above expression because '+=' does assignment and changes the value of
'x'.

There might be a clue there as to why the interpreter is behaving the way it
is when the expression is further wrapped in a cell array.

Adding jwe to the CC list since it will probably require his thinking.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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