Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: named references



"Bart Schaefer" wrote:
> On Jun 28, 10:39am, Peter Stephenson wrote:
> > Subject: Re: named references
> > 
> > I'd be very tempted just to store the name of the object referred to,
> > after a bit of sanity checking, and dereference it right at the last
> > minute as if with ${(P)...}
> 
> The problem with the "at the last minute" approach is that there are a
> lot more places where namerefs have to expose the underlying parameter
> than just in the parameter substitution code.  If the dereference takes
> place too late, it has to be dealt with in multiple places: assignment,
> `unset', substitution, etc.

That's why I mentioned rewriting the parameter code.  The same thing comes
up with ksh `discipline' functions, whose name I couldn't remember.  It
should be possible to intercept gets and sets in this way, even
recursively.  This is certainly not easy with the current code.  If it's
substantially easier to do it the other way for now that's fine.  But I
suspect we (for suitably arbitrary and not necessarily inclusive `we')
might end up rewriting it anyway.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author