octave-maintainers
[Top][All Lists]
Advanced

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

built-in variables


From: James R. Van Zandt
Subject: built-in variables
Date: Thu, 09 Jul 2009 16:07:08 -0400

 address@hidden
 address@hidden
 "Octave contributions" address@hidden

Przemek Klosowski wrote:

> GNU Octave, version 3.0.5 has this weird behavior that the obsolete usage 
> breaks PS*()
> functions:
> 
>     PS1=""
>   warning: PS1 is no longer a built-in variable; please read the NEWS
>   file or type 'news' for details
>   PS1 =
>         PS1("   ")
>   error: invalid matrix index = 32

jwe replied:
> This happened because you created a variable called PS1 which hides
> the built-in function PS1.  Maybe the warning should also say
> something like
> 
>   By assigning a value to PS1, you will create a variable which will
>   hide the built-in function PS1.

Two more points:

I triggered this message, ran news(), then tracked down and read NEWS,
but found nothing relating to PS1.  As it happens, I was running
Octave 3.2 under Cygwin, which doesn't ship the Octave 3.0 news file.

Your addition explains the problem, and suggests how to avoid it in
the future, but doesn't indicate how to fix the problem in the current
session (i.e. get rid of the variable).  I tried "delete", "erase",
and "forget" with no success.  I also spent a lot of time searching
for those terms in the documentation.  It's only easy to find if you
already know the answer.

I suggest a warning something like this:

  warning: PS1 is now a built-in function instead of a variable; see
  "help PS1".  By assigning a value to PS1, you have created a variable
  called PS1 which hides the built-in function PS1.  To eliminate the
  variable, type "clear PS1".

and similarly for other former built-in variables.

             - Jim Van Zandt


reply via email to

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