octave-maintainers
[Top][All Lists]
Advanced

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

Re: Question about octave_function


From: Michael Goffioul
Subject: Re: Question about octave_function
Date: Wed, 15 Jan 2014 21:59:35 -0500

On Wed, Jan 15, 2014 at 8:44 PM, Michael Goffioul <address@hidden> wrote:
On Wed, Jan 15, 2014 at 8:38 PM, John W. Eaton <address@hidden> wrote:
On 01/15/2014 05:13 PM, Michael Goffioul wrote:
Hi John,

I'm trying to solve a problem with classdef package functions. While
analyzing the issue, I'm wondering what's the relation/redundancy
between octave_function::dir_name and octave_user_function::file_name
and in which context one should prefer one over the other.

The problem I'm solving is related to checking out-of-date status of
package functions. The function out_of_date_check is missing the package
information and fails to compare a loaded package function with the
load_path information.

Somehow I have to provide the package information to out_of_date_check.
I believe the best way would be to get that information from the
octave_function object. As out_of_date_check is also used for function
handles, this would make such handles to work for package functions. I'm
thinking about 2 possible implementations:
1) attach package information as another member to octave_function object
2) extract package information from octave_function::dir_name (by
scanning the +-folders at the tail of the path and reconstructing the
package name); this is the reason for my initial question above

Alternatively, I could also add another argument to out_of_date_check
for passing the package name. But then the package information would be
lost in function handles (ov-fcn-handle.h).

I prefer the idea of parsing/storing the info once and caching it in
the octave_function object so that it is easy to retrieve when needed.

Works for me. I preferred to ask, in case there was concern about memory usage for yet-another-member in each function object. I'm gonna add a pack_name member to octave_function, along with the following utility methods:
- stash_package_name()
- package_name()
- canonical_name(): not sure about the name here, it's just to return the fully-qualified/namespaced function name, that is "package_name.function_name"

The attached patch solves the problem I was having. If there's no objection, I'll submit it tomorrow.

Michael.

Attachment: package_function_reload.diff
Description: Text document


reply via email to

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