[erlang-questions] erlang *****

Robert Virding rvirding@REDACTED
Wed Mar 19 02:33:23 CET 2008

On 19/03/2008, Richard A. O'Keefe <ok@REDACTED> wrote:
> I've forgotten who it was who proposed simply allowing multiple
> pattern/guard
> pairs on cases:
>         case E
>           of P1 when E1 ;
>              P2 when E2 -> B2
>            ; P3 when E3 ;
>              P4 when E4 -> B4
>         end
>         f(P1...) when E1 ;
>         f(P2...) when E2 -> B2;
>         f(P3...) when E3 ;
>         f(P4...) when E4 -> B4.
> The syntax could be better, but this extension *does* satisfy all the
> use-cases
> that anyone has actually mentioned wanting in a real program and
> *doesn't* need
> major revisions to the compiler or virtual machine and *doesn't* turn
> clause
> selection into an exponential-time horror.

Those were the reasons that I suggested it, plus that guards are a part of
pattern matching and should be directly connected to the patterns to which
they refer. Also, it was an off the top of my head minimal syntax change so
there is no doubt the syntax can be improved but I wouldn't make it to
different or it could cloud the meaning.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080319/40b01900/attachment.htm>

More information about the erlang-questions mailing list