[eeps] EEP XXX: Pattern-test operator

Erik Søe Sørensen eriksoe@REDACTED
Mon Apr 23 01:36:25 CEST 2012


Den 22. apr. 2012 22.17 skrev Erik Søe Sørensen <eriksoe@REDACTED>:

> [how do you tell gmail about the "mailing list" concept, so that it will
> default to "reply to list", rather than "reply to sender"?...]
>
> I've been considering how to implement this ["?=" / better codegen for
> guards] without disturbing things too much - in particular, without making
> changes to Core Erlang.
>
> I believe that I can argue that the desired extentions simply cannot in
> general be represented with Core Erlang (at least not without duplicating
> code or tests).
>
> These examples may not be minimal, but should illustrate that there is a
> problem:
>   a) receive T when element(1,T) ?= <<1,_>> -> ... end
>   b) receive T when L ?= tuple_size(T), element(1,T) ?= <<D:L>> -> D end
>

Pardon me - I seem to have gotten these (partially) backwards... should of
course be:
  a) receive T when <<1,_>> ?= element(1,T) -> ... end
  b) receive T when L ?= tuple_size(T), <<D:L>> ?= element(1,T) -> D end



> These don't even include 'orelse'.
>
> a) is quite simple, but could be fixed with appropriate new guard BIFs for
> binaries. Lacking such BIFs, there is a problem even without guard->body
> bindings.
>
>
> [snip]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/eeps/attachments/20120423/7b365444/attachment.htm>


More information about the eeps mailing list