Proposal: require spaces around the dot operator

AntC anthony_clayden at clear.net.nz
Mon Feb 13 09:07:37 CET 2012


Gábor Lehel <illissius at ...> writes:

> 
> In any case, while I would in theory support spaces around all
> operators, modulo counterexamples such as those presented above, I'm
> not proposing it and I don't think anyone is, so it's probably best to
> stick to discussing spaces around (.) (which I also support).
> Apologies for taking the discussion off topic.
> 

I'm not arguing for or against dot (and postfix) as record selector.

I'm not arguing whther or not we should support postfix record selector 
(whatever the syntax/symbol).

But _if_ we want postfix, we need to be sure that it binds tighter than 
function apply. Some examples (from TDNR observations on 'something odd', 
and using `?' as postfix field symbol):

    map toUpper customer?lastName
    desugar to ===> map toUpper (lastName customer)

    m?lookup key
    ===> (lookup m) key

No other operator binds tighter than even function apply.

So I think the best way to show that is to disallow spaces around the 
symbol. "It graphically appeals to the notion of a [name] composed of
 several [name]s." As one poster didn't quite put it.

So the advantage of dot from that point of view is:
* dot already appears tightly-bound in qualified names
* dot is already a reserved operator,
  so we won't have to search for some other candidate

AntC




More information about the Haskell-prime mailing list