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: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Steve MarpleOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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:

http://hg.savannah.gnu.org/hgweb/octave/rev/6c952376482d

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:
MATLAB:

>> 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 =

6.5.1.199709 (R13) Service Pack 1

OCTAVE:
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
octave:5> OCTAVE_VERSION
ans = 3.2.3

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

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
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by bpabbott (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 20 Sep 2011 11:01:28 AM UTCbpabbottStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Sun 18 Sep 2011 03:13:09 AM UTCbpabbottStatusNone=>Confirmed
      Release3.4.0=>dev
    Wed 02 Mar 2011 03:32:31 PM UTCNoneAttached File-=>Added test_files.tar, #22826

    Back to the top


    Powered by Savane 3.1-cleanup1