RE: [Haskell-cafe] Records

On 19 November 2005 20:53, Ketil Malde wrote:
Antti-Juhani Kaijanaho wrote:
Ketil Malde wrote: [about A.b and A . b potentially meaning different things:]
Syntax that changes depending on spacing is my number one gripe with the Haskell syntax
I've generally considered that one of the good ideas in most current languages (it's not specific to Haskell). ISTR there was a Basic dialect where IFX=0THENX=X+1 and IF X = 0 THEN X = X + 1 meant the same thing.
My point is that e.g. currently "foo? bar", "foo ?bar" and "foo ? bar" have (at least two) different meanings. Hierarchical naming collides with function composition (admittedly only rarely in practice). Template haskell collides with list comprehensions.
Do you really think that is such a great idea?
I think many people agree that this is a bad thing. It occurs in two places in Haskell 98, I believe: - qualified identifiers (M.T is different from M . T) - single-line comments (--??? is not a comment, but -- ??? is) Both of these were late additions to Haskell, and if we were starting from scratch the syntax would probably not have such anomalies. The other odd cases that GHC has are all extensions too - you mentioned implicit parameters and template haskell, there is also GHC's unboxed values (1#, (#..#)), arrows, and parrays. I would argue against adding any of these syntactic anomalies to the standard language, and we should strive to remove those that we have (e.g. by deprecating the use of '.' as function composition in favour of something else, thus freeing it up for use as record/module selection). I'm assuming you don't consider the distinction between '::' and ': :' to be a problem - the justification for this is simple and logical: a double colon '::' is a reserved symbol, in the same way that 'then' is a reserved identifier. Cheers, Simon

On Sun, 20 Nov 2005, Simon Marlow wrote:
I'm assuming you don't consider the distinction between '::' and ': :' to be a problem - the justification for this is simple and logical: a double colon '::' is a reserved symbol, in the same way that 'then' is a reserved identifier.
I have to admit that even if it weren't my expectation would be for '::' to parse as one operator and complain (of course, as ': :' the odds of it being used in a situation where it typechecks are rather low). -- flippa@flippac.org The task of the academic is not to scale great intellectual mountains, but to flatten them.

"Simon Marlow"
I'm assuming you don't consider the distinction between '::' and ': :' to be a problem - the justification for this is simple and logical: a double colon '::' is a reserved symbol, in the same way that 'then' is a reserved identifier.
Intuitively a contigous string of symbols should form one identifier, just like a string of letters does. So '>>=' is different from '>> =' or '> >=' etc. I suspect I have to make some kind of exception for nesting/grouping symbols - parentheses and quotes etc.
- single-line comments (--??? is not a comment, but -- ??? is)
...so this doesn't bother me so much. Perhaps we need to either start adopting symbols outside of 7-bit ASCII? The other solution is to learn to use actual *names* instead of inventing ad-hoc strings of symbols. Haskell code tends to go overboard with symbolic operators, but in general, it detracts from the readability and adds to the learning curve. We don't have to just because we can. :-) -k -- If I haven't seen further, it is by standing in the footprints of giants
participants (3)
-
Ketil Malde
-
Philippa Cowderoy
-
Simon Marlow