bugGNU Octave - Bugs: bug #45351, function handles to classdef...

 
 

bug #45351: function handles to classdef methods not supported

Submitted by:  Richard <crobar>
Submitted on:  Fri 19 Jun 2015 07:47:12 AM UTC  
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Richard Crozier Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Mon 25 Mar 2019 04:29:11 PM UTC, comment #5: 

I pushed three additional changesets:

http://hg.savannah.gnu.org/hgweb/octave/rev/be5c2a1bad93
http://hg.savannah.gnu.org/hgweb/octave/rev/4ba365817652
http://hg.savannah.gnu.org/hgweb/octave/rev/392b14b0c085

Now the access issue I mentioned in comment #3 appears to be fixed for me.  There is a test in test/bug-45351 for that problem.

I'm closing this report as fixed now.  If there are other issues, then please open a new bug report.

John W. Eaton <jwe>
Project Administrator
Sun 10 Mar 2019 11:46:32 PM UTC, comment #4: 

This has been marked Ready for Test for 3 weeks.  Can it be closed?

Rik <rik5>
Project Administrator
Mon 25 Feb 2019 09:58:45 PM UTC, comment #3: 

I pushed the following changesets related to this bug report:

http://hg.savannah.gnu.org/hgweb/octave/rev/287eba9ed14b
http://hg.savannah.gnu.org/hgweb/octave/rev/80f9bc7cdf74
http://hg.savannah.gnu.org/hgweb/octave/rev/45fc6505a803
http://hg.savannah.gnu.org/hgweb/octave/rev/7e48abcc1032

There is still an access issue that I'm not sure how to handle.  It will show up as an xfail in the new tests.

I also wouldn't be surprised if there are other things related to handles to methods that don't work properly, but I think this is a step in the right direction.

Tests and example code showing what should happen for any and all classdef features would be most helpful, especially if they are in the format needed to add to the Octave test suite.

John W. Eaton <jwe>
Project Administrator
Fri 19 Jun 2015 01:41:04 PM UTC, comment #2: 

Yes, please do add to the wiki page, that should be the best place for someone looking to help improve classdef to start.

Mike Miller <mtmiller>
Project Administrator
Fri 19 Jun 2015 09:20:18 AM UTC, comment #1: 

To add to the issue, replace:

self.hfoo = @foo;

with:

self.hfoo = @(self) self.foo();

or even:

self.hfoo = @(~) self.foo();

and you get the following error:

>> x.bar()
error: subsref: method `foo' has protected access and cannot be run in this context

while both work in MATLAB... Here are some links to related documentation where this is discussed:


By the way, I've been adding similar cases to this wiki page, I hope you guys keep track of it :)

Amro <amro_octave>
Fri 19 Jun 2015 07:47:12 AM UTC, original submission:  

I have attached a file containing a classdef class definition. In the constructor, a handle is created to a method in the class, and it is then called in another method.

This behaviour works in Matlab, but not in Octave

In matlab:

>> x = method_function_handle_test

x =

  method_function_handle_test with no properties.

>> x.bar
hello!

In Octave:

>> x = method_function_handle_test
error: @foo: no function and no method found
error: called from
    method_function_handle_test at line 17 column 17
stopped in <****>/scratch/mfiles/octave_tests/method_function_handle_test.m at line 17
17:       self.hfoo = @foo;

While I find this an odd way to do things I came across it in code in the wild, so it's out there.

Richard <crobar>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34258:  method_function_handle_test.m added by crobar (471B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by amro_octave (Posted a comment)
  • -email is unavailable- added by crobar (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-25 jwe StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2019-02-25 mtmiller Carbon-CopyRemoved 80942 => -
    2019-02-25 jwe StatusConfirmed => Ready For Test
    2015-06-19 mtmiller Severity3 - Normal => 1 - Wish
        StatusNone => Confirmed
        Release4.0.0 => dev
        SummaryHandle to classdef method works in ML but not Octave => function handles to classdef methods not supported
    2015-06-19 crobar Attached File- => Added method_function_handle_test.m, #34258

    Back to the top


    Powered by Savane 3.5