bugGNU Octave - Bugs: bug #32651, Function precedence for derived...


bug #32651: Function precedence for derived classes different to Matlab

Submitted by:  None
Submitted on:  Wed 02 Mar 2011 03:32:31 PM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Steve Marple Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Tue 20 Sep 2011 11:01:28 AM UTC, comment #3: 

John, you're change works for me. Ok to close?

Ben Abbott <bpabbott>
Project Member
Tue 20 Sep 2011 06:16:19 AM UTC, comment #2: 

I checked in the following change yesterday:


I think this change will fix the problem reported here.  I did not include the bug report number in the changeset log text because discovered the problem separately and just noticed this report now.

John W. Eaton <jwe>
Project Administrator
Sun 18 Sep 2011 03:13:09 AM UTC, comment #1: 

Matlab is behaving as I'd expect.

So, in my opinion, this does appear to be an Octave bug.

I'm changing the release to "dev" as I suspect this would modify the API.

My c++ skills are poor and I'm unfamiliar with this part of the code, but if someone can provide a patch I'm can do some testing and apply it to the sources.

Ben Abbott <bpabbott>
Project Member
Wed 02 Mar 2011 03:32:31 PM UTC, original submission:  

In Matlab a class can contain a function having the same name as another class; the purpose of such a function being to convert one object to an object of a different type. In Octave the converter function is never called, the class constructor is always called.

It appears that Octave follows Mathwork's published function precedence (http://www.mathworks.com/help/techdoc/matlab_prog/f7-58170.html#bresuvu-6) whereas Matlab does not. Octave's behaviour does not allow the creation of converter functions as such functions can never be called.

Is this a bug in Octave?

Test results:

>> p2=pcls2

pcls2 constructor

>> pcls(p2)

convert pcls2 to pcls
pcls constructor

>> d=dcls

dcls constructor
pcls constructor

>> pcls(d)

convert dcls to pcls

>> version

ans = (R13) Service Pack 1

octave:1> p2=pcls2
pcls2 constructor
octave:2> pcls(p2)
pcls constructor
octave:3> d=dcls
dcls constructor
pcls constructor
octave:4> pcls(d)
pcls constructor
ans = 3.2.3



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #22826:  test_files.tar added by None (20KiB - application/x-tar)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-20 bpabbott StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2011-09-18 bpabbott StatusNone => Confirmed
        Release3.4.0 => dev
    2011-03-02 None Attached File- => Added test_files.tar, #22826

    Back to the top

    Powered by Savane 3.9