[eeps] EEP XXX: Pattern-test operator

Erik Søe Sørensen <>
Mon Apr 16 10:49:36 CEST 2012

"Assignment attempt operator", eh?  I think I can work with that. :-)
We might then be back to having to nudge Core Erlang, or find ways to
express the bindings neatly in that representation, but that's not
necessarily bad.

(I was somewhat disappointed to find that at present, guards aren't
included in the decision tree calculation; i had hoped that the
pattern/guard separation wasn't so wide in that part of the compiler.)

Den 16. apr. 2012 02.53 skrev Richard O'Keefe <>:

> Let's see where we can get if we
> (1) Fix the operand order to be compatible with =
> (2) Fix the spelling of the operator to be something
>    that suggests matching and suggests testing (for
>    me, with the languages I am familiar with, ~
>    really doesn't do either)
> (3) Spell out the semantics, specifically the escape/
>    propagation of bindings, clearly and explicitly.
>        Pattern ?= Expression
> is a familiar operator (well, it is if you know Eiffel,
> where it's called "assignment attempt") which addresses
> (1) and (2).  I've spent some time on (3), thought I was
> getting close, and realised I'd failed.  In
>        p(X) when Y ?= 10 div X orelse Y ?= oops ->
>            q(Y).
> I definitely want Y to be visible in the body.  With
>        p(X) when Y = 10 div X ; Y = oops -> q(Y).
> the scope rules would have been very nearly automatic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/eeps/attachments/20120416/cc088740/attachment.html>

More information about the eeps mailing list