-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExtraCommas (was: Trailing and leading commas in sub-export lists) #87
ExtraCommas (was: Trailing and leading commas in sub-export lists) #87
Conversation
The code block are currently really messed up, making the proposal difficult to read. |
Thanks for pointing that out 😄 |
I'm +1 on this proposal, although it probably should require a language pragma. One thing this would help me with is that I'll often have something like this:
If I decide that I want to flip the order of |
Does this affect constraint tuples and lists as well? I'd prefer for the same comma semantics across the board if possible. |
@isovector I'm not totally sure about this, but constraint tuples might be totally out of the question. Supporting normal tuples, at both the type and the value level, would be bad, since in the presence of the |
@hvr noted that this has been discussed previously in the Phabricator ticket. I'm going to copy what he posted there:
@isovector It would appear that allowing this for constraints was talked about favorably. |
Agreed with @isovector , nearly all usages of commas and semicolons should be consistent with this decision. The reasoning about CPP here is good, but extends equally well to other delimited sequences in Haskell. Beyond just CPP, it is extremely convenient for code manipulation. Things can be written such that they can be copied / reordered without corner cases for the starts or ends. This is pretty common practice in the JavaScript codebases I've worked on (I know, perhaps emulating JavaScript is not the best way to argue in favor of this, but this is really convenient in practice). It's curious to me that, in a way, we already have this for case statements, do-notation (without curlies), value / type applications, pattern constructor arguments, etc, because they are delimited by whitespace, and it is allowed to be trailing and leading. So, I think it would be uniform for all sequence like things to allow trailing and leading delimiters Tuples can be the rare exception, due to So, in summary I totally agree with the proposal quoted above by @parsonsmatt . At once, it'd be a shame if trying to do the big change meant that nothing gets merged here. Perhaps we could just try it out in the context of extra commas in exports? Would rather avoid the proliferation of extensions, though.. |
With |
This is a great point. The proposal, as it stands, is only concerned with (at least) export sublists. Including import sublists (for trailing/leading commas) and import/export lists (for leading commas) seems to have high support, and would make the language both more convenient and more consistent (given that import/export lists already support trailing commas). Adding leading/trailing comma support to other list forms is not part of this specific proposal. |
in that case, let me state that I won't support this proposal unless it also covers the rest of the Btw, if it's only |
There might not be precedence, but we could discuss whether we allow incompatible language extensions. After all, they are opt-in and for experimentation, so I giving the users an exclusive choice between I am, however, concerned about |
Hmm, making
I think it's fine to allow special interpretations when there are only commas and no elements. It is particularly obvious that these are different if there is a rule that you can either have a leading comma or a trailing comma, but not both. When these are used, it means there is a single comma coming after each element, or a single comma after each element. If there are no elements, then there are no commas. Maybe I shouldn't paint the bikeshed on this, but how about allowing |
the previous wording sounded as if `(a,b,c,)` was recommended, which is not the case for the majority of the cited style guides.
TupleSections are super convenient and I'd hate to lose them to get this. I think we should choose to have ExtraCommas apply to everything but tuples and leave tuples extra special. In my mind this makes perfect sense because an n-tuple is absolutely different than an n+1-tuple or an n-1 tuple, but a list of n elements is effectively the same as a list of n+1 or n-1 elements. (typewise) |
That is a pretty convincing argument. |
It would seem that the Haskell room on Stack Overflow supports this proposal as well: https://chat.stackoverflow.com/transcript/message/41311833#41311833 |
Ah, I knew there was something lurking in my todo list! Alright, so based on the conversation here, we have:
I will try to revise this proposal to include the extra cases for this soon. |
Marking this proposal as such. |
@hvr I'm curious about your opposition to a leading and trailing comma, eg: |
@simonpj has one remaining unresolved question:
I think that we should not allow repeated commas in the middle of the list. |
@mindreader import and export lists are already implemented, and not gated with any
|
To be clear about the vote, it was only supposed to include committee members, and the decision was based only on the votes of the committee members. I suggested the committee vote on the matter because discussion had stalled repeatedly, and it seemed like everyone’s positions were known. All that was left to do was make a decision. I proposed three options based on the committee discussion (primarily on the mailing list, though we switched to the new github model in the middle). That said, I think it’s clear that we handled the situation poorly. As several members of the community pointed out, the vote was taking place during the committee discussion period (during which we ask the community to refrain from commenting), and so the broader community should not have participated in the vote. More importantly, the members who pointed this out felt it would be inappropriate to participate themselves for the same reason. This makes it impossible to draw any meaningful conclusions from the community votes, and we should have just locked the thread for the duration of the vote (as @nomeata suggested later). I am sorry about the confusion this has caused, and have opened #244 to try to improve the process in the future. |
Above I asked
@mboes and @galenhuntington wanted list and record values too. No one has said that fixity declarations and pattern guards are important to them. Does anyone else have an opinion? Matt: would that address your main goals? I ask because
There would be an advantage to having a rapid and uncontroversial "yes", compared to allowing this to drag on. |
I don't mean to be hostile or unfriendly in this, but my patience with the process has worn pretty thin. I don't intend on pursuing any aspect of this proposal any further. If someone wants to carry the torch, then please fork the repository and make a new PR. I intend on closing this PR within the week and deleting my branch. |
Whoa! Why close this? @nomeata writes (in #87 (comment)):
It's true that some debate continued after that point, but I don't see a reason to close the PR -- even if its author wants to move on. (@parsonsmatt, thanks for your patience thus far. You indeed may walk without seeming hostile or unfriendly. This proposal hit the process's squishy points.) Maybe we decide as a committee to just drop the proposal, but it seems premature just to close is, especially after both the committee and the community voted to use this proposal to justify a change in GHC. It does seem like we need a new champion, as Matt is stepping down. I agree that if we can't find one, that suggests we should just close it. I just don't think we're quite there yet. (Of course, I can't reopen because the branch is gone.) |
I can help with the git foo to recover the branch if a new champion would arise (essentially I would have thought that Chris (as the shepherd) would simply update the proposal to reflect the outcome of the vote and then we can simply merge it. |
I’ve been following this from afar for the nearly two years that it’s been gestating, so in light of recent events I’d like to share my thoughts on the whole situation. During the time that y’all have discussed this issue I grew from a hobbyist Haskeller to a commercial user and advocate of the language; however the unprofessional manner in which this process has played out has made me seriously question whether it’s worth investing my time into Haskell in the way that Matt has attempted to here. This was supposed to be an extremely minor syntactic modification that would bring Haskell in line with many other programming languages with respect to trailing commas. Instead of being handled quickly, it’s been the subject of pointless arguments that are wildly disproportionate to the complexity of the proposed changes for such a drawn out period of time that Matt seems to have quite simply burned out. This isn’t the type of environment that’s inclusive to new contributors, which makes me question the manner in which the language will be capable of growing relative to my needs. Further, it creates an environment of expected mental fatigue such that I find myself much less likely to consider a proposal of my own in the future. Please consider the way in which the handling of proposals like this reflects upon not just the committee, but the Haskell overall community in the future. |
Thanks for your thoughts @jkachmar! It inspired me to re-scan the comment thread here in light of your experience. A few reactions:
Really, the only thing I can see that has gone wrong here is the length of time the proposal has been under debate -- which is highly regrettable. I'd be very curious to know if you (@jkachmar or anyone else) see this differently. This suggests a possible way to improve our process: set an expiration date on proposals. (I propose this to be 6 months, given that we are but volunteers.) Deadlines spur action. If a proposal is about to expire (or has recently expired), then it is up to the committee to decide what happens next, and quickly. The time for public debate will have ended. We just decide and move on. Would something like this seem to improve your perceptions, @jkachmar? |
(Your mention of expiration dates on language proposals reminds me of yesterday's http://smallcultfollowing.com/babysteps/blog/2019/07/10/aic-unbounded-queues-and-lang-design/ which is exploring how to improve Rust's language design process. Apologies if this is too far off-topic.) |
Many thanks @dwijnand for bringing in that very relevant post. It's a bit of a different proposal than what I brought up, but it's good to think broadly about potential changes to our process. One interesting note buried in there: it seems that Rust's lang team rewrites accepted proposals to have a tighter specification. That's an interesting idea. Some of the proposals in our process have languished for want of a tighter specification, and perhaps the proposers don't have the experience / knowledge base to do that well. Our resources are stretched, so I don't know about having the committee rewrite proposals, but it's an interesting alternative to consider. |
I have realized that there's an alternative which has not been covered in the discussion of this proposal and would work for tuples, lists, records, export/import lists, and very much any other enumeration. No unicode syntax. Add an extension,
With this extension, when an opening bracket is immediately followed by a newline, we consider this list (or tuple, or record) to be layout-based rather than comma- or semicolon separated. More examples:
|
There are various layout-based proposals in this thread (you have to click hard to find them, the thread is too long), including markdown-style bullets, or an explicit keyword herald ( But we should find a different venue than this thread. Maybe open an issue to brainstorm them? Or somewhere else (on the Haskell or GHC wiki) where we can explore the design space? (I agree that separators are a bad idea and layout is great) |
Ugh, I just wrote something on the GHC wiki, but when I submit I get an error 500. Luckily I rescued my text from the Firefox console… Ah, I have to login first. Anyways, lets move the discussion to https://gitlab.haskell.org/ghc/ghc/wikis/All-things-layout, feel free to add more sections with variants, and maybe a comment section. |
As Jakob points out in #317 this Maybe we should just call our loses and drop this, as Richard suggests in #87 (comment), removing the |
+1 for labels reflecting reality. If this is explicitly marked as abandoned, somebody else might pick it up. If it's in limbo, nobody won't. |
Coming from Python, I have been a big proponent of trailing commas. I certainly do see the point that Haskell is a different language, and many languages just aren't going to get trailing commas. I also really like the no-comma proposals (I do like lisp for this as well. Maybe I should pick up clojure...))))))) |
Rendered.