bugGNU Octave - Bugs: bug #36230, new function files in @myclass...

 
 

bug #36230: new function files in @myclass directory are not parsed when already in load path

Submitted by:  Guillaume Simard <gsimard>
Submitted on:  Tue 17 Apr 2012 07:20:26 PM UTC  
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Simard Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Sat 19 Nov 2016 09:31:02 PM UTC, comment #3: 

This behavior is still fully present in Octave 4.2.0.

Hartmut <hardy>
Mon 30 Sep 2013 02:51:57 AM UTC, comment #2: 

Confirmed present in the development version. The @myclass directory does not have to be added to the path, as long as the directory containing it is in the path.

In Octave's pwd, in another terminal while Octave is running, create a class constructor:

$ mkdir @myclass
$ cat > @myclass/myclass.m
function x = myclass ()
  x = class (struct (), "myclass");
endfunction

Now in the running Octave, construct an object of type "myclass"

octave:1> x = myclass ()
x = <class myclass>

Now create the method newfunc in the @myclass directory, while the same Octave is still running:

$ cat > @myclass/newfunc.m
function y = newfunc (x)
  y = x;
endfunction

And back inside Octave:

octave:2> newfunc (x)
error: 'newfunc' undefined near line 1 column 1
octave:3> rehash
octave:4> newfunc (x)
error: 'newfunc' undefined near line 1 column 1

Now resetting the path makes it work:

octave:5> path (path ());
octave:6> newfunc (x)
ans = <class myclass>

Mike Miller <mtmiller>
Project Administrator
Tue 19 Jun 2012 11:58:56 AM UTC, comment #1: 

I checked to see how Matlab behaves, and found that Matlab does not allow paths beginning with "@" to path().

Even so, as Octave does for the moment, have you checked to see if the problem persists if "@" is not the first character in the directory?

I don't see this problem on MacOS. Can you reliably reproduce it? Does "rehash()" properly refresh the path for you?

Ben Abbott <bpabbott>
Project Member
Tue 17 Apr 2012 07:20:26 PM UTC, original submission:  

addpath("/directory/containing/folder@myclass")

create a new file @myclass/newfunc.m with valid newfunc function, then invoke it on an object of type myclass

newfunc(c)

error: `newfunc' undefined ...

However if addpath is called AFTER the file is created, in other words if the file exists prior to calling addpath, invocation of newfunc(c) works just fine.

Guillaume Simard <gsimard>

 

(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 hardy (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by gsimard (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-22 mtmiller Severity3 - Normal => 2 - Minor
        SummaryNew files in folder @myclass are not scanned after addpath is called => new function files in @myclass directory are not parsed when already in load path
    2013-09-30 mtmiller Item GroupNone => Incorrect Result
        StatusNeed Info => Confirmed
        Release3.6.1 => dev
    2012-06-19 bpabbott StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5