bugGNU Octave - Bugs: bug #34831, cannot create a private class

 
 

bug #34831: cannot create a private class

Submitter:  Patrick Gosling <jpmg>
Submitted:  Tue 15 Nov 2011 01:55:21 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.3 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 28 Jan 2014 04:12:06 AM UTC, comment #3: 

This will most likely not be implemented in Octave. There has not been much activity on this bug report in over 2 years. Also this feature is not supported at all in Matlab [1]:

> You cannot put class definitions in private folders because doing so would not meet the requirements for @ or path folders.


[1] http://www.mathworks.com/help/matlab/matlab_oop/organizing-classes-in-folders.html

Mike Miller <mtmiller>
Group Member
Wed 16 Nov 2011 06:58:36 PM UTC, comment #2: 

I saw somewhere on the octave site a section on matlab differences, IIRC private dirs in class definitions are not scanned (at all).

You can make them public if that does not cause issues elsewhere by them not being private.

HTH , Charlie

Anonymous
Tue 15 Nov 2011 10:45:00 PM UTC, comment #1: 

I'm slightly embarrassed that my attempt to produce a minimal example meant that I forgot to call class() in the constructor;

However, if I add the line

ret = class(ret, "foo");

to the constructor, it still fails to make the class work.

Patrick Gosling <jpmg>
Tue 15 Nov 2011 01:55:21 PM UTC, original submission:  

If I create a class directory within a private directory, the class does not become available for use within the current directory;  nor does it become available for use within the private directory.

So if I create ./testit.m containing


function testit()
   f = foo(1);
endfunction


and also create ./private/@foo/foo.m containing


function ret = foo(a)
   ret.x = a;
endfunction


then it will complain with


error: `foo' undefined near line 2 column 8


It will also complain similarly, if you attempt to construct a foo from within a private function. 

So if I also create ./private/privfoo.m containing


function ret = privfoo(a)
   ret = foo(a);
endfunction


and a file test2.m containing

function ret = test2()
   f = privfoo(1);
endfunction


then privfoo() called from test2() will complain in just the same way.

So I don't currently see any way of constructing a class that has the property of being private.

Patrick Gosling <jpmg>

 

(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 mtmiller (Posted a comment)
  • -email is unavailable- added by jpmg (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-28 mtmiller StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code