the dreaded offside rule
Philippa Cowderoy
flippa at flippac.org
Wed Mar 8 17:12:13 EST 2006
On Wed, 8 Mar 2006, Doaitse Swierstra wrote:
> 1) it is impossible to explain the precise workings of the rule to a class
> of first years undergraduates
>
> This is extremely demotivating. I do not want to teach using the
> following utterances: "If you write your programs in the same style as I do on
> my slides, you will usually get away with it". Students are perfectly happy to
> accept that complicated things are complicated, but are not very willing to
> buy complicated explanations for things which ought to be simple. I
> furthermore think it is waist of time to to have to go into this in my
> lectures. I do not think the alternative, in which you always have to write {
> ; ; } is an option. A language in which every let is followed by a { is plain
> stupid; just like in Pascal, where each procedure, function, const, var and
> begin keyword has to be preceded by a (thus superfluous) semicolon.
>
I found the layout rule trivial to understand the moment I knew about the
braces-and-semicolons versions of the constructs and that the layout rule
desugars to that with some simple rules. After that it was just a matter
of remembering where the braces are on which constructs.
I can see it might be a little harder explaining it to a class who haven't
seen a braces-and-semicolons language before Haskell though.
--
flippa at flippac.org
'In Ankh-Morpork even the shit have a street to itself...
Truly this is a land of opportunity.' - Detritus, Men at Arms
More information about the Haskell-prime
mailing list