Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Parameter aliasing? RE: PATCH: "typeset -m" plays havoc
- X-seq: zsh-workers 12830
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Parameter aliasing? RE: PATCH: "typeset -m" plays havoc
- Date: Mon, 18 Sep 2000 12:40:52 +0400
- Importance: Normal
- In-reply-to: <000001c01f3b$77210c80$21c9ca95@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
>
> > erase_PS1() { typeset PS1 prompt PROMPT }
>
> Hmm ... in case of prompts what (very probably) happens:
>
> - for the first parameter typeset_single() calls copyparam() to save old
> value; this creates new parameter and copies old *string* value.
> Then it sets
> value to "" creating new empty parameter - that actually sets variable
> "prompt" to empty string.
> - for the second and third parameters exactly the same happens ...
> but now the
> saved value is already empty string (all three actually refer to the same
> variable "prompt").
>
Note, that the same happens in case of three different typeset's as well.
The only clean general way to do it is to introduce real aliases instead of
separate parameters internally referencing the same value. In this case first
typeset would save original value and two others would simply do nothing
(well, they would actually print parameters value. But there is no real way to
avoid it).
One point to decide is: should 'unset alias' remove parameter itself (with all
aliases) or just unset current alias? And if we want user-defined aliases?
-andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author