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

RE: PATCH: new parameter expansion type?



Andrej Borsenkow wrote:

> > Ok, the `.' thingy is just because I couldn't think of a better
> > character/syntax (suggestions?) and this isn't as powerful as I would
> > like it because `then' and `else' can't expand to arrays. Maybe we
> > could make `${(A)foo^?^$arr1^$arr2}' do that (and maybe we could do
> > the same for `${(A)foo:-$arr}'.
> >
> 
> Remember discussion of backreference in new regexp implementation? I think, we
> should unify it with ${.../...} & Co code. There are two possibilities:

Sure I remember that, but it's a different thing -- or how would you
do an if-then-else with `${.../...}'? Or are you suggesting
`${.../pat/repl-then/repl-else}'? Hm.

> And about arrays and scalars - well, I'm afraid, this needs revising once more.
> Else we simply create one more ad hoc case. What is needed, is clear notion,
> when we have "array context" and "scalar context". Then it is possible to
> define, when result of substitution is an array and scalar. Currently, there is
> only really vague definition of "list of words". I just wish, result of
> substitution be better typed.

It isn't that vaguely defined -- ${..:-..} produces just a string. For 
${foo^..} we would have to say what happens if the then/else produces
more than one string and foo is an array (all strings inserted instead 
of the original element, I would say).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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