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

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

[Octave-bug-tracker] [bug #35118] incorrect builtin() behaviour in objec


From: anonymous
Subject: [Octave-bug-tracker] [bug #35118] incorrect builtin() behaviour in object methods
Date: Mon, 19 Dec 2011 19:59:27 +0000
User-agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0

URL:
  <http://savannah.gnu.org/bugs/?35118>

                 Summary: incorrect builtin() behaviour in object methods
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 19 Dec 2011 19:59:26 UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: J.J. Green
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Consider the following trivial class


@myobj/myobj.m

function f = myobj(str)
  f.name = str;
  f = class(f,'myobj');

@myobj/display.m

function display(f)
  fprintf('%s\n',f.name);

@myobj/transpose.m 

function f = transpose(g)
  % do interesting things with input ...
  f = builtin('transpose',g);


Now, lets make an array of these ...


GNU Octave, version 3.5.90+
Copyright (C) 2011 John W. Eaton and others.
:

octave:1> p = myobj('foo')
foo
octave:2> q = myobj('bar')
bar
octave:3> a = [p q]
foo
bar
octave:4> size(a)
ans =

   1   2

octave:5> class(a)
ans = myobj
octave:6> b = a.'
error:   ../@myobj/transpose.m at line 3, column 3
error:   ../@myobj/transpose.m at line 3, column 3
 :
(and lots more of these)


It seems that the builtin array transpose is not "seen"
in the overloaded transpose method for the object, so it
calls itself again and again until some kind of recursion
depth is exceeded.

The same code runs fine on Matlab


                           < M A T L A B (R) >
                  Copyright 1984-2011 The MathWorks, Inc.
                    R2011b (7.13.0.564) 64-bit (glnxa64)
                              August 13, 2011
  
>> p = myobj('foo')              
foo
>> q = myobj('bar')
bar
>> a = [p q]
foo
bar
>> size(a)

ans =

     1     2

>> b = a.'
foo
bar
>> size(b)

ans =

     2     1


Similar problems arise with other array methods (eg vertcat)




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 19 Dec 2011 19:59:26 UTC  Name: octave-builtin-bug.tar.gz  Size:
515B   By: None
scripts exhibiting the described (mis)behavoiur
<http://savannah.gnu.org/bugs/download.php?file_id=24630>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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