Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(P)${foo}} (Re: Associative array ordering)
- X-seq: zsh-workers 5196
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: ${(P)${foo}} (Re: Associative array ordering)
- Date: Wed, 3 Feb 1999 00:39:08 -0800
- In-reply-to: <199902030802.JAA10576@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199902030802.JAA10576@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author