[erlang-questions] illegal guard expression for IF illegal guard expression for "if"

Richard O'Keefe ok@REDACTED
Tue Dec 6 21:21:44 CET 2011

On 6/12/2011, at 3:24 PM, Barco You wrote:

> >For example, suppose you often want to match [{opt,X}].
> >Then you will one day be able to write
> >
>  >      #one_opt(X) -> [{opt,X}].
> Your 'abstract pattern' looks like macro!

No more than any function does.  The syntax and semantics are fully
checked at the point of declaration; patterns can use abstract
patterns from modules not yet written let alone loaded; and while
it was never part of the original design, because there wasn't a type
system then, it would be perfectly possible to give abstract patterns
types, e.g.

-spec #one_opt(X) -> [{'opt',X)}].

Try doing _that_ with a macro.

More information about the erlang-questions mailing list