bugGNU Octave - Bugs: bug #51295, functions in +package directories...

 
 

bug #51295: functions in +package directories no longer work correctly

Submitter:  Mike Miller <mtmiller>
Submitted:  Thu 22 Jun 2017 10:16:46 PM UTC
   
 
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  jwe
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 30 Jun 2017 10:44:17 PM UTC, comment #6: 

Verified on Linux as well. Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 28 Jun 2017 06:37:48 PM UTC, comment #5: 


Checking on Win-7


>> __octave_config_info__ ("hg_id")
ans = 315a3dcc229c
>> foo.myfunc
ans =  3.1416
>> foo.myfunc (1)
ans =  1


Avinoam Kalma <avinoam>
Group Member
Sat 24 Jun 2017 03:54:18 PM UTC, comment #4: 

I checked in the following additional changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/c84328c2a6c7

John W. Eaton <jwe>
Group administrator
Fri 23 Jun 2017 11:30:36 PM UTC, comment #3: 

This still does not work fully. If the function is called with arguments, nargin is zero


>> type +foo/myfunc.m
+foo/myfunc.m is the user-defined function defined from: /home/mike/src/octave/foo/+foo/myfunc.m

function y = myfunc (x)
  if (nargin > 0)
    y = x;
  else
    y = pi;
  endif
endfunction

>> foo.myfunc
ans =  3.1416
>> foo.myfunc(1)
ans =  3.1416


Mike Miller <mtmiller>
Group Member
Fri 23 Jun 2017 10:24:18 PM UTC, comment #2: 

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/ffd27f53fc79

I'm not super happy with this change, but I don't see another way to do it at the moment.  It does seem to work though, and also seems to fix the problem for bug #51296.

John W. Eaton <jwe>
Group administrator
Fri 23 Jun 2017 12:53:30 AM UTC, comment #1: 

I started looking at this and I'm not sure exactly what's happening but I suspect it's the subsref part of it that's to blame.

John W. Eaton <jwe>
Group administrator
Thu 22 Jun 2017 10:16:46 PM UTC, original submission:  

With changeset 084245f9bd03 (https://hg.savannah.gnu.org/hgweb/octave/rev/084245f9bd03), calls to functions in +package directories no longer work correctly.


$ find .
.
./+foo
./+foo/myfunc.m
$ octave
>> foo.myfunc
ans =

error: octave_base_value::print (): wrong type argument 'user-defined function'
>> foo.myfunc(1)
error: can't perform indexing operations for user-defined function type


It's like the function object is being returned as an object instead of being executed.

Mike Miller <mtmiller>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 avinoam (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-30 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-06-23 jwe StatusNone Ready For Test
    2017-06-23 jwe Assigned toNone jwe

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code