List syntax (was: Re: help from the community?)

Douglas Philips dgou at mac.com
Sat Feb 3 13:16:09 EST 2007


On 2007 Feb 2, at 11:17 PM, Kirsten Chevalier indited:
>> You just highlighted the inconsistency:
>>         You refer to "import lists"... you appear to think of the  
>> import
>> syntax _as a list_,
>> and it is precisely that mental processing where the inconsistency
>> hits/grates.
>> If it is an "import" _list_ it can have trailing commas, but if it is
>> some <other> _list_, it can't.
>> I don't see the justification for making those two cases different.
>
> The thing that I think Neil and Ganesh were trying to get at is that
> an import list can't appear in just any context (that's what's meant
> by it not being a first-class value), so Haskell programmers *do*
> usually think about them differently.

If that is the case, the question becomes:
	How should "how one thinks about them" be reflected in the syntax?
Aren't [ 1, 2, 3 ] and ( 1, 2, 3 ) thought about differently?
Yet isn't it enough that a mere bending of the brackets is enough to  
distinguish them?

To exaggerate for effect: :-)
	Are we "fooled" by the commas?
	Are newbies wailing at the gates for being confused and thwarted in  
their understandings by the heinous comma?

Already there are many places in the syntax where commas are used as  
"separators for items in a larger-group".

Yet if "how one thinks about those groups" were a driving factor at  
the syntax level, the syntax would not be as unified as it is, would  
it? How can we (humans) unify all that: Yes, this is a _list_, that  
is a _tuple_, over there is a _deriving_ clause ... and yet are we  
confused that they all use commas? Apparently not. We are confused  
that in certain contexts a trailing comma is permitted and in others  
it is not, because there is no underlying or unifying principle  
apparent. It is just rote memorization that does not serve a higher  
principle/purpose.

What power have I gained by allowing a trailing comma in some places,  
but not uniformly everywhere that a comma is used _as a separator_?  
Cause I sure gain a lot by not having to remember niggling details  
about "Oh yes, I can use it here, but not there." And that has  
nothing to do with "how I think about the larger semantics"... "comma  
separated items in a group" is just too prevalent for it to belong to  
only one little domain...

So yes, I agree, how I think about those groups is very different.  
And the syntax of grouping things is similar enough that it gets out  
of the way... I'd just like to make it uniform in this one regard.

	--D'gou



More information about the Haskell-prime mailing list