Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Case statement with ";|" [not implemented]
- X-seq: zsh-users 11135
 
- From: Peter Stephenson <pws@xxxxxxx>
 
- To: zsh-users@xxxxxxxxxx
 
- Subject: Re: Case statement with ";|" [not implemented]
 
- Date: Fri, 19 Jan 2007 12:01:20 +0000
 
- In-reply-to: <070118205243.ZM30783@xxxxxxxxxxxxxxxxxxxxxx> 
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
- References: <e5d50bd20701181153j4ac7faeajd0ec871ea02af518@xxxxxxxxxxxxxx> <070118205243.ZM30783@xxxxxxxxxxxxxxxxxxxxxx>
 
Bart Schaefer wrote:
> } Note that ";|" provides an OR-like separator (as opposed to the AND-like
> } ";&" separator)
> 
> This analogy doesn't work.  Semantically, the test for whether $mycase
> matches any one of the labels occurs once at the top of the statement.
> Control then jumps into the body as if with a GOTO, and thereafter all
> you're able to change with ;& is how early you exit from the body.  It
> isn't anything like AND / OR.
> 
> By comparison, your proposed ;| requires the interpreter to reproduce
> the pattern match test at every label, which implies storing the result
> of expanding $mycase, etc.  Most languages don't allow one to hide quite
> that much complexity behind syntactic sugar.
I think we simply have to apply the restriction that the word in the
case statement is expanded only once at the start of the case statement.
I don't see that's either unnatural or confusing.  With this it looks
like it ought to be quite straightforward, possible even trivial, to
implement.
-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author