Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: PATCH: new parameter expansion type?
- X-seq: zsh-workers 7542
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Sven Wischnowsky" <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, <zsh-workers@xxxxxxxxxxxxxx>
- Subject: RE: PATCH: new parameter expansion type?
- Date: Mon, 30 Aug 1999 14:06:02 +0400
- Importance: Normal
- In-reply-to: <199908300949.LAA20865@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
> 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:
- use "standard" way and let \& refer to the whole match and \n, ... to n-th
subpattern
- use $match/$MATCH (or anything you like) to refer to the last matched
(sub)patterns where $match[n] refers to n-th match and $MATCH to the whole
match.
The latter is better as it does not introduce new metacharacters and can be used
outside of parameter expansion ... but it implies, that in ${.../...},
${...^...} the substitution is expanded after the matching is done.
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.
/andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author