From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27413 invoked from network); 30 Aug 1999 10:06:16 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Aug 1999 10:06:16 -0000 Received: (qmail 22877 invoked by alias); 30 Aug 1999 10:06:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7542 Received: (qmail 22870 invoked from network); 30 Aug 1999 10:06:06 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Sven Wischnowsky" , Subject: RE: PATCH: new parameter expansion type? Date: Mon, 30 Aug 1999 14:06:02 +0400 Message-ID: <000301bef2cf$440b5ce0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <199908300949.LAA20865@beta.informatik.hu-berlin.de> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Importance: Normal > 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