zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: <zsh-workers@sunsite.auc.dk>
Subject: Parameter aliasing? RE: PATCH: "typeset -m" plays havoc
Date: Mon, 18 Sep 2000 12:40:52 +0400	[thread overview]
Message-ID: <002a01c0214c$276649e0$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <000001c01f3b$77210c80$21c9ca95@mow.siemens.ru>

>
> >     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


  parent reply	other threads:[~2000-09-18  8:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-14 15:42 Bart Schaefer
2000-09-14 16:55 ` Andrej Borsenkow
2000-09-14 17:35   ` Bart Schaefer
2000-09-14 18:20     ` Bart Schaefer
2000-09-15 16:35       ` Bart Schaefer
2000-09-15 17:36         ` Andrej Borsenkow
2000-09-15 18:46           ` Bart Schaefer
2000-09-17  3:53             ` PATCH: "typeset +m ..." and "typeset +g -m ..." Bart Schaefer
2000-09-18  8:40           ` Andrej Borsenkow [this message]
2000-09-18 15:45             ` Parameter aliasing? RE: PATCH: "typeset -m" plays havoc Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002a01c0214c$276649e0$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).