Change of current context ? (whos -file ...)
David Bateman
adb014 at gmail.com
Mon Sep 22 14:08:32 CDT 2008
John W. Eaton wrote:
> I understand the motivation for this approach as it would be a
> relatively simple change, but maybe we should instead modify do_load
> in load-save.cc to skip the call to install_loaded_variable and return
> the variable names instead? I see do_load already has a way to return
> the names (the list_only option). This change might require a little
> refactoring, but maybe it would not be too difficult?
>
In fact this is the way I tried to do it when I added the -regexp option
to the who function a few months ago. The logical way to treat this
would be to move the variables.cc (class symbol_info_list) to
variables.h and then use it i load-save.cc (do_load). This allows
exactly the same format as with whos itself in the load function.
However, the symbol_info_list class is in fact a list of symbol_records
and so there is in fact no gain in not calling install_loaded_variable
to a temporary context. I suppose the proper way is to rewrite
symbol_info_list to not store the symbol_record itself but only the
necessary information, though that is a bit more that a little bit of
refactoring.
The method I talked about doesn't let "load -l" profit from the same
code, but that is an Octave extension in any case, and so probably
better to use the Matlab way in any case. So in short for the minimum
effort its probably better just to do it the way I suggested but include
a FIXME comment discussing the issue.
Regards
David
More information about the Octave-maintainers
mailing list