bugGNU Octave - Bugs: bug #50452, methods defined as separate...

 
 

bug #50452: methods defined as separate function files under +package directory not found

Submitter:  Marc Dirix <dirixmjm>
Submitted:  Sat 04 Mar 2017 08:22:35 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 21 Mar 2019 05:30:23 PM UTC, comment #2: 

I'm closing this bug as a duplicate of bug #54941, where there has been slightly more discussion and examples shown. Also a workaround shown there is to define the method prototype in the class definition.

Mike Miller <mtmiller>
Group Member
Tue 22 Aug 2017 06:52:11 PM UTC, comment #1: 

Confirmed in the development version of Octave as well.

One notable way this does work is if the class is defined using classdef syntax, and if all the methods are defined in the class body, or at least with prototypes in the class body.  For example


classdef polynomial < handle
...
  methods
    disp (p);
    a = double (p);
    ...
  endmethods
endclassdef


Mike Miller <mtmiller>
Group Member
Sat 04 Mar 2017 08:22:35 AM UTC, original submission:  

If I create the following class (from the documentation)

@polynomial/polynomial.m
@polynomial/display.m

I am able to use the class as:

>> p = polynomial([-1 0 1])

p = - 1 + X ^ 2

>> display(p)

p = - 1 + X ^ 2

However, if I put this in a +package as follows:
+foo/@polynomial/polynomial.m
+foo/@polynomial/display.m

Then the function "display.m" is not resolved.

>> p = polynomial([-1 0 1])

p = <class polynomial>

>> display(p)

p = <class polynomial>

If I insert the display function inside the polynomial.m file it is once more resolved correctly.

So in effect it doesn't register the location of the class correctly.

Marc Dirix <dirixmjm>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by dirixmjm (Submitted the item)
  • -email is unavailable- added by dirixmjm
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-21 mtmiller StatusConfirmed Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #54941
    2017-08-22 mtmiller CategoryOctave Function Interpreter
        StatusNone Confirmed
        Release4.2.1 dev
        Operating SystemMicrosoft Windows Any
        SummaryOctave is not resolving class functions in +package folder methods defined as separate function files under +package directory not found
    2017-03-04 dirixmjm Carbon-Copy- Added dirixmjm

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code