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

Re: easy calling of associative array?



On Nov 1,  7:33pm, Ray Andrews wrote:
}
} But what would prevent this from being parsed?:
} 
} ${${ref}[idx]}
} ${${ref}[$idx]}

Those both ARE parsed.  The problem is, that form is defined to mean
something different than what it would have to mean for it to work
in (P) context.  It's not a parsing issue.

} Also, that form  works with normal arrays.

Presuming you mean ${${(P)ref}[idx]}, because it means something else
if you leave out the (P) or put it somewhere else.

Anyway, that's actually the point.  ${(P)ref} resolves to the values of
the array, and then the subscript is applied.  Ask yourself: what are
"the values of" an associative array, in every other context?



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