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

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

[Octave-bug-tracker] [bug #63023] Private function not available in PKG_


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #63023] Private function not available in PKG_ADD context
Date: Wed, 7 Sep 2022 03:35:42 -0400 (EDT)

Update of bug #63023 (project octave):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #1:

I'm not sure I understand correctly. Could you please attach a minimal
reproducer?

>From what I gathered, you are trying to do the following:
- You have a (PKG_ADD) script in a folder that has a function in a private
folder.
- You create a handle to the private function in that script.
- You'd like to call the private function after the script has executed (from
a folder that doesn't have direct access to the `private` folder).

I tried to replicate this with the following in Octave 7.2.0:
- Create a folder `test_dir0` with the following `PKG_ADD` file:

disp('In folder with private function');
priv_fcn = @private_fcn;

priv_fcn()

cd ..  % or any other folder that doesn't have access to private_fcn

disp('In folder away from private function');

priv_fcn()


- In that folder, create a `private` folder.
- In that `private` folder, create the file `private_fcn.m` with the following
content:

function private_fcn()

disp('private_fcn');

end

- `cd` to the parent folder of the folder with the `PKG_ADD` script.
- From here, I see the following in Octave:

>> addpath(canonicalize_file_name('test_dir0'))
In folder with private function
private_fcn
In folder away from private function
private_fcn
>> priv_fcn()
private_fcn


That use case seems to work for me...



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63023>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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