On 30 Jun, Bart Schaefer wrote: > We should emulate ksh when `name' is already a nameref. > However, we could follow our usual pattern of choosing some other syntax > that's illegal in sh/ksh and giving it additional semantics; e.g. Okay, that sounds good though I'll get the basics working first before any new for syntax. > > > } what should ${(t)ref} return - the same as what it refers to with > > > } -nameref- inserted? > Hmm, that's probably true. In which case I'm not even sure if it should > insert -nameref- anywhere. Hard to say. I know what you mean. My thinking behind inserting -nameref- was that it would enable shell code to detect namerefs -- so for example I can write a proper completion for unset -n -- while being compatible with any old shell code that pattern matches against the output of ${(t)ref} (which most probably does). > > In 5068, you said that ksh has "separate namespaces for namerefs and > > parameters". Can you remember what you meant by that? > > Exactly what you mentioned before -- `nameref ref=var; typeset ref' > doesn't output anything, and `unset ref' doesn't remove `ref', so the > name `ref' does not behave like a parameter name. What I didn't realize > at the time was that `unset ref' actually removes `var', nor that there The name `ref' does behave like a parameter name in ksh. `typeset ref' is just defining ref if it isn't already defined so it will never output anything for any variable in ksh. You have to do `typeset|grep ref'. > was such a thing as `unset -n'. (Flags to `unset'? Heresy!) Well, we already have two flags to unset -- -f and -m (and I've just realised that I've not done a completion for them). Anyway, I had a little time on the weekend to look at using a pointer for the nameref. I am convinced that it is the better way, it'll just be slightly less easy because I have to meddle more with existing code. The first problem is that fetchvalue() currently returns NULL for PM_UNSET variables which I'm probably going to have to change. In case anyone is interested, attached is a descripton of ksh93 features which aren't in zsh. Let me know if you know of things to add to it. Oliver