the dreaded offside rule

Neil Mitchell ndmitchell at
Wed Mar 8 17:43:37 EST 2006


>    1) it is impossible to explain the precise workings of the rule to
> a class of first years undergraduates

Then don't explain it to them. At York in the 3rd year Haskell course
it is never explained in detail, I think it might be briefly mentioned
in passing that some kind of indentation thing is used, but not
focused on. I certainly don't have a clue what the rule is.

I believe the Haskell rule is a superset of the Miranda (TM) one? If
so just explain the Miranda one.

I have a friend, who was programming Haskell for 3 years before he
even realised that the indentation had an effect on the program! And
not trivial stuff, he wrote a lot of big programs. If you just do
sensible indentation, then it just works (TM).

As for hugs complaining about semi-colons, thats just a bad error
message - not a reason for a language change.

Of course, your point about being overly complex is possibly true -
but I don't think its possible to reduce the complexity without
breaking existing programs, and I don't think its worth doing that.

The one thing about having the offside rule which bugs me is that some
people use tabs with 8 spaces (Haskell standard), others use 4 (me)
and others use variable other sizes. This makes code 100% incompatible
between different people. I would make it a warning to use a tab in a
Haskell source file.



More information about the Haskell-prime mailing list