[Haskell] offside rule question
Axel Simon
A.Simon at kent.ac.uk
Fri Jul 15 04:10:16 EDT 2005
Brian,
On Thu, 2005-07-14 at 19:58 -0500, Brian Smith wrote:
> On 7/14/05, Frederik Eaton <frederik at a5.repetae.net> wrote:
> > On Thu, Jul 14, 2005 at 03:15:32AM +0200, Lennart Augustsson wrote:
> > > The offside rule is patronizing. :)
> > > It tries to force you to lay out your program in a certain way.
> > > If you like that way, good.
> >
> > I disagree. The offside rule in general makes a more concise syntax
> > available to the programmer, who would probably choose a similar
> > indentation style anyway. The issue that I brought up is a case where
> > the programmer is *prevented* from using a certain syntax, for the
> > sole reason that, if what you say is correct, someone has determined
> > that the prohibition is "good for him". I dislike such design
> > rationales because they always end up hurting advanced users, who may
> > have atypical needs, but who should ideally play an important role in
> > promoting the language to others; it makes it seem like the plan is
>
> I don't understand how a rule that requires one to prefer
> easier-to-read layout over more-difficult-to-read layout is bad, if
> each alternative is of equal verbosity (as is the case here).
I agree with Frederik since I've been bitten by that rule before.
Defining a single function like so:
let a very long definition of "a" = and the body has to be here
is a very long application to
"and" and using long arguments
like definition is a pain
in
is harder to read and might force you to use shorter, less descriptive
variable names.
let an even longer definition of a function called "an" =
is much easer to read I think
in
It is up to the programmer to write easy to write programs, not the
language. I changed the 'a' to '"a"' afterwards which also forced me to
indent the whole rhs as well. It's not a good feature IMHO. That said, I
don't know if it's easy to change of if there are other ambiguities
popping up.
Axel.
More information about the Haskell
mailing list