
13 Nov
2009
13 Nov
'09
7:02 a.m.
Am Freitag 13 November 2009 11:05:15 schrieb Andrew Coppin:
Colin Paul Adams wrote:
If I had a dollar for every time I've written something like
Andrew> case msg of eVENT_QUIT -> ... eVENT_POST -> ... Andrew> eVENT_RESIZE -> ...
Andrew> and spent an hour trying to figure out why the messages Andrew> aren't being processed right... ;-)
So why aren't they?
Because what I *should* have written is
case msg of _ | msg == eVENT_QUIT -> ...
| msg == eVENT_POST -> ... | msg == eVENT_RESIZE -> ...
which is something quite different.
(And, entertainingly, because the incorrect version is perfectly valid source code, no compiler errors or warnings...)
It yells "overlapping patterns" -- you do pass -Wall, don't you?