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

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

[Octave-bug-tracker] [bug #32651] Function precedence for derived classe


From: anonymous
Subject: [Octave-bug-tracker] [bug #32651] Function precedence for derived classes different to Matlab
Date: Wed, 02 Mar 2011 15:32:32 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13

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

                 Summary: Function precedence for derived classes different to
Matlab
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Wed 02 Mar 2011 15:32:31 UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Steve Marple
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.4.0
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 02 Mar 2011 15:32:31 UTC  Name: test_files.tar  Size: 20kB   By:
None

<http://savannah.gnu.org/bugs/download.php?file_id=22826>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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