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

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

[Octave-bug-tracker] [bug #54783] subsasgn call when the subscripted exp


From: Guillaume
Subject: [Octave-bug-tracker] [bug #54783] subsasgn call when the subscripted expression contains the end keyword
Date: Thu, 4 Oct 2018 11:56:24 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

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

                 Summary: subsasgn call when the subscripted expression
contains the end keyword
                 Project: GNU Octave
            Submitted by: gyom
            Submitted on: Thu 04 Oct 2018 03:56:22 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Guillaume
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

If you define this class:


classdef testasgn
 
  properties
    x;
  end
  
  methods
    function v = subsref (this, s)
      fprintf ('subsref\n');
      for i = 1:numel (s)
        disp (s(i))
      end
      v = 1:5;
    end
     
    function this = subsasgn (this, s, v)
      fprintf ('subsasgn\n');
      for i = 1:numel (s)
        disp (s(i))
      end
    end 
  end
  
end



You get the following in Matlab:


>> m = testasgn;
>> m.x(end) = 0;
subsref
    type: '.'
    subs: 'x'

subsasgn
    type: '.'
    subs: 'x'

    type: '()'
    subs: {[5]}

>> m.y(end) = 0;
subsref
    type: '.'
    subs: 'y'

subsasgn
    type: '.'
    subs: 'y'

    type: '()'
    subs: {[5]}


while Octave does:


>> m = testasgn;
>> m.x(end) = 0;
subsasgn
  scalar structure containing the fields:

    type = .
    subs = x
  scalar structure containing the fields:

    type = ()
    subs =
    {
      [1,1] = 0
    }

>> m.y(end) = 0;
error: subsref: unknown method or property: y


My understanding of it is that, when m.x is evaluated, the subsref function
called is the one for the underlying structure and not the method of the class
as it should be.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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