[erlang-questions] Pattern matching in guards - status?

Erik Søe Sørensen <>
Wed Feb 15 19:43:59 CET 2012


Hello -
I was considering writing an EEP for adding the possibility of having
pattern matching in guards (as well as a test in expressions), when I
noticed hints around the 'net that this had already been discussed at some
point.

In particular, EEP-29[1] mentions it:

   -

   Stage 0: Allow pattern matching in guards. This is the subject of
   another EEP, as it is desirable in itself. This MUST be implemented first
   before implementing Stage 1, because that's what we want inlinable pattern
   calls to expand to.

as well as this post[2]:

*Robert Virding> *No, you cannot do pattern matching in guards.
It has been discussed and would be possible, but for now you can't.

Does anyone know what the status is of this idea?
I see no existing EEP for it, but that of course doesn't mean that it isn't
done elsewhere - or has for some reason been dropped.

Thanks,
Erik Søe Sørensen

PS: For what it's worth: EEP-29 goes on to say this in the "reference
implementation" section:
Given stage 0, this stage 1 is within my knowledge and abilities, but I
don't understand the Erlang VM well enough to do stage 0.
>From my knowledge of the Erlang VM and in particular the byte code format,
I'm reasonably certain that at least for the semantics I have in mind, no
VM changes are needed -- i.e., only compiler and shell will need to be
extended.

[1] http://www.erlang.org/eeps/eep-0029.html
[2] http://erlang.org/pipermail/erlang-questions/2009-December/048562.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120215/8caa86e2/attachment.html>


More information about the erlang-questions mailing list