[PEAK] Adding early ambiguity warnings to PEAK-Rules?

Николай niki.spahiev at gmail.com
Thu Aug 19 08:17:38 EDT 2010

> There is one other downside to immediate ambiguity checks, though, and
> that's rule ordering.  If our main example is checked immediately, then you
> can't write your rules like this:
>  when(f, (A, B))(...)
>  when(f, (B, A))(...)
>  when(f, (B, B))(...)
> Because you'll get a warning on the second rule.  Instead, you'll have to do
> this:
>  when(f, (B, B))(...)
>  when(f, (A, B))(...)
>  when(f, (B, A))(...)
> Which seems a bit unfortunate, as it's basically forcing you to put the
> special case before the general cases!  (Which is bad for both the reader
> and writer of the code.)

Wild idea: use something like

when(f, (A,B), delaycheck)(...)
when(f, (B,A), delaycheck)(...)

del delaycheck

and trigger check when delaycheck is collected or at first call f() to
warn about missing 'del delaycheck'. If no delaycheck is provided do
checks normal way


|  (\_/)  This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

More information about the PEAK mailing list