[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Private functions and user objects
From: |
John W. Eaton |
Subject: |
Private functions and user objects |
Date: |
Tue, 22 Jul 2008 21:39:17 -0400 |
On 22-Jul-2008, WMennerich wrote:
| I played a little with Octave 3.1.50, investigating the new user objects
| features
| (Windows built) and was wondering a little bit:
| If a object function is private, i.e. it is stored in an subdirectory named
| 'private' of the class definition directory (@dirname), octave does not find
| this function anymore.
|
| Example:
|
| Directory '@testObj' contains the constructor 'testObj.m' and a function
| 'fun.m'
|
|
| A subdirectory of '@testObj', named 'private' contains the function
| 'privFun.m'.
|
| 'fun.m' calls only 'privFun.m' in the 'private' subdirectory
|
| Test:
| Create an object:
|
| >>x=testObj(<some arguments>)
|
|
| Now, call the private function via fun.m:
|
| >>fun(x)
|
| Result: Error: privFun.m was not found.
|
| Is this only a bug or are private functions not yet provided by octave?
I guess it is a missing feature. I think if you look at
load-path.{h,cc} and the symbol_table::fcn_info::fcn_info_rep::find
function in symtab.cc, you'll see that private directories that are
themselves subdirectories of @ directories aren't considered. This
isn't an intentional omission, it's just that this case didn't occur
to me when I implemented the new load path and symbol table code.
jwe