octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #45444] Private functions inside namespace and


From: Amro
Subject: [Octave-bug-tracker] [bug #45444] Private functions inside namespace and class directories
Date: Tue, 30 Jun 2015 14:05:34 +0000
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0

URL:
  <http://savannah.gnu.org/bugs/?45444>

                 Summary: Private functions inside namespace and class
directories
                 Project: GNU Octave
            Submitted by: amro_octave
            Submitted on: Tue 30 Jun 2015 05:05:32 PM EEST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Any

    _______________________________________________________

Details:

The following describes an issue related to path
<http://www.mathworks.com/help/matlab/search-path.html>, packages
<http://www.mathworks.com/help/matlab/matlab_oop/scoping-classes-with-packages.html#brfynt_-3>
and classes
<http://www.mathworks.com/help/matlab/matlab_oop/organizing-classes-in-folders.html#br5wlnh>,
and private functions
<http://www.mathworks.com/help/matlab/matlab_prog/private-functions.html>:


./testdir/+foo/
./testdir/+foo/bar.m
./testdir/+foo/private/baz.m


where "bar.m" is a function that calls a private function "baz.m".


function x = bar()
    x = baz();
end


and


function x = baz()
    x = pi;
end


In Octave the following fails (while it works fine in MATLAB):


>> addpath('C:\testdir')
>> foo.bar()
error: 'baz' undefined near line 2 column 9
error: called from
    bar at line 2 column 7


I had to explicitly add the private folder to the path for it to work:


>> addpath('C:\testdir\+foo\private')
>> foo.bar
ans =  3.1416


----

Similarly, private functions inside @-class folders:


./testdir/@MyClass/
./testdir/@MyClass/MyClass.m
./testdir/@MyClass/private/myfunc.m


Trying to call "myfun.m" from class methods will generate a similar 'undefined
function' error... 

----

This was initially reported in #45410, but I'm creating a separate bug report
for it.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45444>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]