From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8131 invoked from network); 18 Sep 2000 08:41:35 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Sep 2000 08:41:35 -0000 Received: (qmail 22577 invoked by alias); 18 Sep 2000 08:41:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12830 Received: (qmail 22566 invoked from network); 18 Sep 2000 08:41:00 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: Subject: Parameter aliasing? RE: PATCH: "typeset -m" plays havoc Date: Mon, 18 Sep 2000 12:40:52 +0400 Message-ID: <002a01c0214c$276649e0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <000001c01f3b$77210c80$21c9ca95@mow.siemens.ru> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 > > > 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