Bang patterns

Atze Dijkstra atze at uu.nl
Thu Feb 7 15:25:51 CET 2013


On  7 Feb, 2013, at 13:24 , Simon Marlow <marlowsd at gmail.com> wrote:

> On 04/02/13 23:42, Ian Lynagh wrote:
>> On Mon, Feb 04, 2013 at 10:37:44PM +0000, Simon Peyton-Jones wrote:
>>> 
>>> I don't have a strong opinion about whether
>>> 	f ! x y ! z = e
>>> should mean the same; ie whether the space is significant.   I think it's probably more confusing if the space is significant (so its presence or absence makes a difference).
>> 
>> I also don't feel strongly, although I lean the other way:
>> 
>> I don't think anyone writes "f ! x" when they mean "f with a strict
>> argument x", and I don't see any particular advantage in allowing it.
>> In fact, I think writing that is less clear than "f !x", so there is an
>> advantage in disallowing it.
>> 
>> It also means that existing code that defines a (!) operator in infix
>> style would continue to work, provided it puts whitespace around the !.
> 
> FWIW, I really dislike whitespace-significant syntax.  f ! x should mean the same as f !x.  Look at the trouble we have with qualified operators: how many people have tried to write [Monday..] and been surprised that it doesn't work?
> 
> So I don't mind at all if BangPatterns makes it harder to write a definition of '!', because it's much more common to write bang patterns than it is to define '!', and the workaround of writing (!) is not that onerous.
> 

I agree, I prefer the invariant that lexically whitespace does not matter. It is easier to understand, implement, and it is not such a big deal to have the choice of meaning (i.e. bang pattern or infix operator) depend on a LANGUAGE pragma, (re)defining ! is not that common anyway.

cheers,


               - Atze -

Atze Dijkstra, Department of Information and Computing Sciences. /|\
Utrecht University, PO Box 80089, 3508 TB Utrecht, Netherlands. / | \
Tel.: +31-30-2534118/1454 | WWW  : http://www.cs.uu.nl/~atze . /--|  \
Fax : +31-30-2513971 .... | Email: atze at uu.nl ............... /   |___\






More information about the Haskell-prime mailing list