StricterLabelledFieldSyntax

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Mon Jul 27 03:38:00 EDT 2009


Neil Mitchell <ndmitchell at gmail.com>
writes:

> Hi
>
>>> Would it be proper to create a counterproposal for this syntax?
>>> ReversedLabelledFieldSyntax?
>>
>> I would claim that, of the existing Haskell code,
>> StricterLabelledFieldSyntax only rejects unclear ("bad") code, and
>> requiring it be changed (to be made clearer) is a good thing.
>
> I haven't seen anyone else claim to use the current more liberal
> syntax for fields, but I know that I do rather extensively. I would
> consider:
>
> Just A {a = 1}
>
> To be confusing, but if you simply omit the space:
>
> Just A{a = 1}
>
> I now find that perfectly clear and unambiguous. I realise this isn't
> necessarily a discussion of the merits of the feature, but I don't
> consider this removal as clear cut as some people are suggesting.

for what it's worth, I do take advantage of the current syntax for
functions with default parameters:

  f defaults{some_option = non_default_value}

and like you, I don't put a space. I've long thought that compilers
should issue warnings for layout that conflicts with precedence --
everyone knows that 2+2 * 8 means 2 + (2*8), but I'd guess it takes a
/tiny/ bit longer to read correctly, and for less familiar operators the
misleading layout is more likely a source of misreadings.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-prime mailing list