Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Singleton arrays treated as scalars
- X-seq: zsh-workers 6049
- From: mason@xxxxxxxxxxxxxxx (Geoff Wing)
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Singleton arrays treated as scalars
- Date: 16 Apr 1999 07:52:48 GMT
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- Organization: PrimeNet Computer Consultants
- References: <990416001836.ZM13152@xxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: mason@xxxxxxxxxxxxxxx
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> typed:
:I tried this again and got much better results for two-or-more element
:arrays, but singleton arrays were still getting subscripted as scalars.
:Investigation led me to this fragment of paramsubst():
:
: if (isarr > 0 && !plan9 && (!aval || !aval[0])) {
: val = dupstring("");
: isarr = 0;
: } else if (isarr && aval && aval[0] && !aval[1]) {
: val = aval[0];
: isarr = 0;
: }
:
:Well, look at that. If we have a singleton array, make it into a scalar.
:This doesn't have anything to do with multsub() at all!
:
:Does anybody remember why this code is here? What part of the world is
:going to come crashing down if that "else if" clause gets deleted?
It's a pf artifact. Looking in 2.00.03 sees it there in a slightly
different incantation but logically the same.
--
Geoff Wing <gcw@xxxxxxxxx> Mobile : (Australia) 0412 162 441
Work URL: http://www.primenet.com.au/ Ego URL: http://pobox.com/~gcw/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author