.octaverc files cannot be functions

Jaroslav Hajek highegg at gmail.com
Thu May 21 23:59:16 CDT 2009


On Thu, May 21, 2009 at 11:10 PM, Joel LeBlanc <jwleblan at gmail.com> wrote:
> Bug report for Octave 3.0.5 configured for i386-apple-darwin
> Description:
> -----------
>     .octaverc files cannot presently be functions (only scripts).  If the
> file is a function, it will not execute.  It is nice to not be working in
> the scope of the base workspace, and allow temporary variables to fall out
> of scope rather than having to do all the cleanup by hand.
> Repeat-By:
> ---------
>     Use the following .octaverc
>
>     function .octaverc
>     disp('here');
>     end
>
>     "here" will not be displayed.
> Fix:
> ---
>     Simply evaluate the .octaverc file (as a script or function) if it
> exists.
>
>

.octaverc is supposed to be a script, and it is evaluated as if passed
to "source".
Function names cannot contain a dot (".") and must be contained in
m-files (".m" suffix), hence what you ask for would be invalid syntax
anyway. But nothing prevents you from defining a function in .octaverc
and then executing it, to avoid polluting the base scope.

cheers


-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



More information about the Bug-octave mailing list