From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1944 invoked from network); 28 Jun 2001 08:07:53 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Jun 2001 08:07:53 -0000 Received: (qmail 22019 invoked by alias); 28 Jun 2001 08:07:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15153 Received: (qmail 22003 invoked from network); 28 Jun 2001 08:07:02 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: Subject: RE: named references Date: Thu, 28 Jun 2001 12:07:43 +0400 Message-ID: <000501c0ffa9$68c68350$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) In-Reply-To: <3B3A2D7A.7B8EA3AF@u.genie.co.uk> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 Importance: Normal This does not touch everything (I need some time to swallow the rest :-) > > > So I'd suggest adding to the union: > > HashNode ref; /* value if declared nameref > (PM_NAMEREF) */ > > Using a pointer for the reference is something I considered when I > started out. The problem is how to deal with references to unset > parameters. ... and ... > > > I don't think that's necessary, but it raises the question of > what really > > happens when a reference-to-a-reference is made. That is: > > > > typeset v1 v2 > > typeset -n r1=v1 > > typeset -n r2=r1 > > typeset -n r1=v2 > > > > At this point, is r2 still a reference to v1, or has it become > a reference > > to v2? That is, is r1 dereferenced at the time of assignment to r2, or > > not until time of dereference of r2? This ... > > not until time of dereference of r2. r2 will be and will remain a > reference to `r1' whatever r1 is whether that be unset, another > reference, an array or scalar. > What happens in this case: foo() { typeset -n r=v local v=foo echo $r } v=bar foo I.e. does r refer to outer v ("by address" could you say) or to inner v ("by name" would it be then)? The latter would be badly broken; but to implement the former you must have reference to pm not the name. -andrej