[eeps] Multi-Parameter Typechecking BIFs
Fri Feb 27 02:55:48 CET 2009
On 27 Feb 2009, at 2:42 am, mats cronqvist wrote:
> Apparently. Of course, some people confuse easier than others.
> Just in case someone else is interested in my actual opinion about
> guards in receive clauses (unlikely as it seems); I'm undecided.
But you said that 'when' was a mistake.
No softening, no hesitation, no quibbles or caveats,
just plain "a mistake".
Now you say you are undecided.
> suspect the pattern
> Bla when G ->
> where G cannot be expressed as a match or a type check is rare.
Why "suspect"? How about *measuring*.
With the tools at hand, it was too hard to count which
'when's where in 'receive' and which were not. Looking
at all 'when's
25108 'when' parts.
That's (roughly) 17068 guards that include something
other than a match or type check, or 68% of the whole.
So I wrote a rather crude filter. Take this with the
proverbial grain of salt.
2319 'when' parts in receives
That's (roughly) 1160 non-match-or-type-checks,
or about 50% of the whole.
These *are* rather rough metrics, based on tokenising
not parsing. But they're the best figures we've seen
so far about this.
And the result is that receive guards that would NOT
reduce to matching and type tests are anything but
rare. About half of the receive guards in Erlang/OTP
are of this form. 50% is not rare.
More information about the eeps