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

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

[Octave-bug-tracker] [bug #46571] Inconsistency between old and new oop


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #46571] Inconsistency between old and new oop syntax (wrt subsasgn)
Date: Tue, 2 Aug 2016 07:53:09 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0

Update of bug #46571 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   4.0.0 => dev                    

    _______________________________________________________

Follow-up Comment #2:

Actually I think the error is occurring in the parser, but I am not sure why
it is triggered for new-style classes but not old-style classes.

With just a trivial class definition / constructor and no other methods
defined, this error occurs with classdef:


@someclass/someclass.m:

classdef someclass < handle
endclassdef

>> x = someclass;
>> x{'foo'} = 0
error: invalid assignment to cs-list outside multiple assignment


but not if the class is a struct-based old-style class:


@someclass/someclass.m:

function y = someclass ()
  y = class (struct (), "someclass");
endfunction

>> x = someclass;
>> x{'foo'} = 0
error: class cannot be indexed with {


In the first case, the error is caught when the parser is evaluating the
assignment expression. In the second case, the error is only because there is
no custom aubsasgn method defined.

You're right that it has something to do with interpreting the string index as
an array of multiple indices, but I'm not clear at the moment why it's not a
problem when the old class definition style is used.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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