[Top][All Lists]

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

[Octave-bug-tracker] [bug #56856] class method calls overloaded function

From: anonymous
Subject: [Octave-bug-tracker] [bug #56856] class method calls overloaded function instead of basic function
Date: Wed, 4 Sep 2019 17:38:36 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #2, bug #56856 (project octave):

Oh, you're right the example did not illustrate the issue with 'x' being
mistakenly replaced by 'this'. It seems like I wrote this short example too
quickly, sorry about that.

Attached is a new version which hopefully works this time. The problem arises
this time with the following code:
  clear x % just making sure x is not yet assigned
  a = test
  x(10) = a

The situation is slightly more elaborated: an object of class 'test' is
assigned onto an empty 'double' array. This rightly triggers a call to
'test.subsasgn(val, idx, rhs)', with parameters:
  val = x
  rhs = a

However, from within the function 'test.subsasgn', the variable 'val' is
suddenly not an empty double array, but rather it has become an object of type
'test', more precisely a '<object array test>'. rhs has remained itself, an
object of type test, more precisely a '<object test>'.

calling 'size(val)' then triggers the function 'test.size' instead of calling
the size function for (empty) double arrays.

(file #47454)

Additional Item Attachment:

File name: @test2.zip                     Size:0 KB


Reply to this item at:


  Message sent via Savannah

reply via email to

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