[erlang-questions] Lack of warning for overlapping clauses with
Thu Jul 22 13:51:38 CEST 2010
On 2010-07-21, at 11:48 , Attila Rajmund Nohl wrote:
> 2010/7/21, Torben Hoffmann <>:
>> On Tue, Jul 20, 2010 at 23:53, Richard O'Keefe <> wrote:
>>> So nhc98 was completely silent, and ghc 6.6.1 did notice the
>>> explicit pattern duplication but did *NOT* notice the duplication
>>> of a pattern in a guard, any more than Erlang did.
>> I stand corrected! Thanks for putting my assumptions to a timely death!!
> I think there's one more thing: Erlang function clauses overlap all
> the time. It's a common pattern that:
> f(1) -> ok;
> f(2) -> ok;
> f(_) -> not_ok.
> and obviously the third pattern overlaps with the first two, but we
> really don't want a warning for that.
But the catchall pattern is a bit of a special case, in that it really means "everything not matched yet" here.
More information about the erlang-questions