Proposal: require spaces around the dot operator

Anthony Clayden anthony_clayden at clear.net.nz
Fri Feb 10 04:06:12 CET 2012


> ... I'm struggling to see why people
> are fighting so hard to get the dot character in
> particular for field access. It seems like a huge amount
> of work and discussion for a tiny bit of syntactic
> convenience that we've only come to expect because of
> exposure to other very different languages.

Dan/all,

I think yous should backtrack to SPJ's SORF and TDNR
proposals, and the Yesod/Reddit discussion that triggered
the latest 'Records in Haskell' threads.
http://hackage.haskell.org/trac/ghc/wiki/Records

SORF: "It is critical to support dot-notation."

TDNR: "Exploting the power of the dot"

TDNR: "a feature that has a _cultural_ connection to OO,
       but that turns out to be fully compatible with a
functional language."

TDNR: "I have deliberately used dot ..."
      "It's standard practice, and that counts for a lot."
      "Selecting a field from a record is a particularly
convenient special case, ..."
      "... is doing the same job as Haskell's existing
qualified names, ..."


I guess the 'clincher' for me is that if we're going to ask
SPJ to implement anything (and there's no-one else who's
capable) we'd better have very powerful reasons to go
against his so clearly expressed views.

Remember GHC/Haskell Prime is not run as a democracy, it's a
benevolent meritocracy.

We've probaly only got one shot: if we don't include dot
notation with whatever happens for 'Records in Haskell',
we'll probably never get dot notation. SPJ has made it clear
Records is not a priority. If it contues to be an area for
hot dispute, it'll just die a death (again).


I do, however, agree with you questioning the effort going
into surface syntax vs. deep semantics.  (The relative
effort is confirming Wadler's rule.)

Because what's not getting enough 'airtime' is how we
address even the "narrow issue: namespacing for record field
names."

What we are tending to get (apart from the hatchet-job on
the dot) is another bundle of half-baked suggestions for the
impossibily difficult "broad issue: first class record
types".

I'm working towards a proposal for the narrow issue. I'm
trying to make the changes to Haskell as minimal as
possible. So far, I've built a prototype in GHC v 7.2.1
(with many record-oriented extensions), which gives me hope
I'm mostly asking for syntactic sugar.

It's been somewhat helpful with the design to 'test the
water' through the discussion lists. It's also been
distracting. I've only had one response that was really,
really helpful and on-topic -- and that was from SPJ, who
(heck knows) is a very busy person.

I don't want the response to my proposal (if/when I get time
to write it up convincingly) to focus on the dot. Luckily,
under my design, the dot is very much syntactic sugar. (So
actually, it would be absurdly simple to implement, and even
simpler to leave out. That is, simple compared to
implementing the semantics.) I don't need it. I'm in two
minds whether even to mention it.


AntC





More information about the Haskell-prime mailing list