[ghc-steering-committee] Extra Commas

Richard Eisenberg rae at richarde.dev
Thu Apr 25 16:19:06 UTC 2019



> On Apr 24, 2019, at 3:30 AM, Simon Marlow <marlowsd at gmail.com> wrote:
> 
> I'm not sure about allowing the combination of TupleSections and ExtraCommas. It would mean that (x,) has a different meaning depending on what extensions are in force.

While I agree that this situation is suboptimal, it already exists in multiple ways. For example `f $x` has different meanings depending on whether -XTemplateHaskell is enabled -- and sometimes, both would type-check but mean different things. `data T a = MkT` has a different meaning depending on whether -XPolyKinds is enabled, and this change is not strictly conservative due to the potential for ambiguity when generalizing. At top-level, `pattern Nothing = Just ()` has a different meaning depending on whether -XPatternSynonyms is enabled; both meanings are error-free. My point here is that this argument doesn't hold much sway, for me -- the cows have already left the pasture. (I do agree that letting yet another calf out isn't great, but it's not, to me, a self-standing argument for rejection.)

What allowed me to consider the possibility of combining both extensions is that the change in interpretation would almost always lead to a type error, so that an author meaning one interpretation but getting another can simply twiddle extensions. If the change in interpretation would manifest only at runtime, say, or only in downstream modules, I'd be much less sanguine.

So my vote is to have both, but do not interpret this as a vote against "everything but tuples", which seems to be gaining momentum.

Richard

PS: I agree that this is a matter of editor support, and I'm not a fan of extra commas. But I hear a chorus of voices asking for this feature, and so I'm inclined to go with the wisdom of the crowd here.


More information about the ghc-steering-committee mailing list