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

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

[Octave-bug-tracker] [bug #48802] function overload resolution should be


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #48802] function overload resolution should be performed on function handles
Date: Tue, 16 Aug 2016 19:49:38 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0

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

                 Summary: function overload resolution should be performed on
function handles
                 Project: GNU Octave
            Submitted by: mtmiller
            Submitted on: Tue 16 Aug 2016 12:49:35 PM PDT
                Category: Interpreter
                Severity: 1 - Wish
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

According to the Matlab documentation, a function handle should behave with
respect to overloading the same way as any other function call would.

> Overloading — If the function you specify overloads a function in a class
that is not a fundamental MATLAB class, the function is not associated with
the function handle at the time it is constructed. Instead, MATLAB considers
the input arguments and determines which implementation to call at the time of
evaluation.

(From
https://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html.)

In other words, if I have a user-defined class that implements a double()
conversion method,


a = 42;
b = someclass ();
fn = @double;
x = fn (a);
y = fn (b);


this snippet should work correctly. Currently, Octave throws a "invalid
conversion from object to double" error.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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