From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes From: "Bart Schaefer" Message-Id: <990203003908.ZM10211@candle.brasslantern.com> Date: Wed, 3 Feb 1999 00:39:08 -0800 In-Reply-To: <199902030802.JAA10576@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: ${(P)${foo}} (Re: Associative array ordering)" (Feb 3, 9:02am) References: <199902030802.JAA10576@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (4.0b.820 20aug96) To: Sven Wischnowsky , zsh-workers@sunsite.auc.dk Subject: Re: ${(P)${foo}} (Re: Associative array ordering) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 5196 On Feb 3, 9:02am, Sven Wischnowsky wrote: } Subject: Re: ${(P)${foo}} (Re: Associative array ordering) } } Bart Schaefer wrote: } } > There are actually several ways we can go from here. } > } > We can keep Sven's syntax as is. } > } > We can modify Sven's syntax so that ${(P)foo} is the same as ${(P)${foo}}, } > and make ${!foo} a synonym for it in ksh compatibility mode. This is } > almost like ksh namerefs except that they don't get their own namespace. } } I first thought about implementing ${(P)foo}, but implementing only the one } I did, seemed easier. I suspect that's at least in part how we ended up with ${${param}} instead of simply ${{param}} in the first place, but .... } Now that I had a deeper look into the substitution } code again, making ${(P)foo} work doesn't look that complicated, too. } Although that would be less powerful, so keeping the thing I } implemented may still be useful. Yes, particularly ${(P)$(...)} is probably useful, even if ${(P)${...}} was not. } Making ${!foo} a synonym may be useful, and as far as I can this we } wouldn't have to restrict this to ksh compatibility mode (am I missing } something?). You're missing `setopt banghist`, which is unsetopt in ksh mode. ${!foo} will have substituted the history item beginning with "foo" long before it makes it to the parameter code. That's why the ${!assoc[@]} syntax is accepted only in ksh mode, too. Let's go this way: Implement ${(P)foo}, the same as ${(P)${foo}} where the inner ${...} has no flags or modifiers, and leave ${!foo} undefined until we do real namerefs (if we ever do). -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com