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

Re: Case statement with ";|" [not implemented]

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

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