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

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

[Octave-bug-tracker] [bug #55383] Function handle does not evaluate the


From: anonymous
Subject: [Octave-bug-tracker] [bug #55383] Function handle does not evaluate the correct function for the given object type
Date: Fri, 4 Jan 2019 06:59:58 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.80 Chrome/71.0.3578.80 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55383>

                 Summary: Function handle does not evaluate the correct
function for the given object type
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 04 Jan 2019 11:59:54 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Jonas
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

A minimum failing example and fix is in the attachment.

Assuming you have a class that implements a method with the name of a builtin
function, e.g. log, sum, times...

Then you create a function handle to the method/function and evaluate the
function handle on an object of the class:


logFH = @(obj)log(obj);
a = Matrix(4)
logFH(a);


Will fail with: 
error: log: not defined for object

I seems that Octave tries to evaluate the builtin log instead of the log
method of the object.

The fix is the following:


logFH = @(obj,varargin)log(obj);
a = Matrix(4)
logFH(a);




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 04 Jan 2019 11:59:54 AM UTC  Name: Matrix.m  Size: 229B   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=45865>
-------------------------------------------------------
Date: Fri 04 Jan 2019 11:59:54 AM UTC  Name: testMatrix.m  Size: 130B   By:
None

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

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55383>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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