From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 141 invoked by alias); 27 Jan 2015 16:25:04 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34414 Received: (qmail 25452 invoked from network); 27 Jan 2015 16:24:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Ko/6AtSI c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=3BjeYfpbbqEp6IBo948A:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150127082435.ZM1243@torch.brasslantern.com> Date: Tue, 27 Jan 2015 08:24:35 -0800 In-reply-to: <16472.1422309949@thecus.kiddle.eu> Comments: In reply to Oliver Kiddle "Re: Partial implementation of "nameref", sort of." (Jan 26, 11:05pm) References: <150125162016.ZM11528@torch.brasslantern.com> <16472.1422309949@thecus.kiddle.eu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Partial implementation of "nameref", sort of. MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 26, 11:05pm, Oliver Kiddle wrote: } } This is storing the string reference to the name, right? That is also } what the somewhat more complete implementation from back in 15058 did Indeed, I'd forgotten all about that. I saw the shortcut that seemed to be possible by simply setting aspar in paramsubst() and decided to see what I could do with it. } At the time, my understanding of the consensus was that an } implementation needed to instead use a pointer as the internal } representation of the reference There's now a tmpdata pointer in the Param struct which may not have been present in 2001. Perhaps it could be leveraged for this. } (along with either reference counting or garbage collection). Yeah, that's the tricky bit -- finding the namerefs in the event the pointed-to variable is unset or goes out of scope. There'd have to be an intermediate struct that points in both directions, or something. } It's a more useful feature in Ksh which has lexically scoped local } variables. Ksh special cases nameref ref=$1 to take the referenced } parameter from the parent scope which seems quite ugly to me. I'd prefer } something more explicit like Tcl's uplevel command. Agreed.