<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Mon, 10 Feb 2020 at 14:15, Richard Eisenberg <<a href="mailto:rae@richarde.dev">rae@richarde.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Upon careful consideration, I think the whitespace concerns here are somewhat ill-founded.<div><br></div><div>First, please see <a href="https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst#proposed-change-specification" target="_blank">https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst#proposed-change-specification</a>, where (among other points), a careful description of "loose infix" vs "prefix" vs "suffix" vs "tight infix" is discussed. Here is a set of examples:</div><div><pre>a <span>!</span> b   <span><span>--</span> a loose infix occurrence</span>
a<span>!</span>b     <span><span>--</span> a tight infix occurrence</span>
a <span>!</span>b    <span><span>--</span> a prefix occurrence</span>
a<span>!</span> b    <span><span>--</span> a suffix occurrence</span></pre></div></div></blockquote><div>Yes and I was not very keen on that proposal (my concerns are on the discussion thread).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><div>This distinction is *not* just made by example, but that proposal (which has been accepted) defines these precisely. So, the comments on this thread about what counts as a naked selector are addressed: a naked selector is one where the dot is a prefix occurrence.</div><div><br></div><div>Other whitespace-wariness comes from worrying about the distinction between prefix and tight infix occurrences. That is, should we differentiate between the interpretation of `f r.x` and `f r .x`. Yet in all versions of any of this, we differentiate between loose infix and the others. Thus there is *always* whitespace-sensitivity around dot. Note that this is true, as Simon PJ pointed out, regardless of this proposal, where a tight-infix usage of a dot with a capitalized identifier on the left is taken as a module qualification. In all of its versions, this proposal *increases* the whitespace sensitivity, by further distinguishing between prefix occurrences of dot and other usages.</div><div><br></div><div>Let's compare options 3 and 5 with this analysis then:</div><div><br></div><div>Option 3:</div><div>loose-infix: whatever (.) is in scope</div><div>tight-infix:</div><div>  - if left-hand is a capitalized identifier: module qualification</div><div>  - otherwise: record selection, binding tighter than function application</div><div>prefix: postfix record selection, binding like function application</div><div>suffix: presumably, whatever (.) is in scope</div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><div><br></div><div>Option 5:</div><div>loose-infix: whatever (.) is in scope</div><div>tight-infix:</div><div> - if left-hand is a capitalized identifier: module qualification</div><div> - otherwise: postfix record selection, binding like function application</div><div>prefix: postfix record selection, binding like function application</div><div>suffix: presumably, whatever (.) is in scope</div></div></div></blockquote><div><br></div><div>That's a good summary - but note that under Option 5 tight-infix and prefix are the same, modulo the qualified-identifier case, and this is the key difference. What I wanted to avoid was having to use the language of tight-infix vs. prefix AT ALL in understanding how record selection syntax works, and (5) achieves that whereas (3) doesn't.</div><div><br></div><div>Under option 5 we get one new lexeme: <br></div><div>   .<varid></div><div>and everything else can be handled at the context-free grammar level. This is a nice minimal addition to the language. We don't have to invoke the mess that is proposal #229, which was forced upon us because BangPatterns and TypeApplications made the handling of (!) and (@) so complicated. If we don't have to do the same to (.), I believe we should take the opportunity to avoid it.</div><div><br></div><div>Cheers</div><div>Simon<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><div><br></div><div>My point here is that option (5) is no more or less whitespace sensitive than option (3). Both need the same cases to figure what the period character in your code means. I think this is why Simon PJ has keyed this part of the debate to module qualification: that existing feature (not under debate) essentially breaks the symmetry here, meaning that we have more room to work with without breaking symmetry further.</div><div><br></div><div>My vote is thus:</div><div><br></div><div>3 > 5 > 2 > 4 > 1</div><div><br></div><div>Other points of motivation:</div><div>- Despite my argument above, I see the merit in (5). I just think that an argument "we don't want dot to be whitespace-sensitive" isn't really effective.</div><div>- I want to accept this proposal. We're not going to get another go at this.</div><div>- I really don't like the way record-update binds, and (4) reminds me too much of that.</div><div><br></div><div>Richard</div><div><br><blockquote type="cite"><div>On Feb 10, 2020, at 9:58 AM, Simon Marlow <<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="ltr">On Fri, 7 Feb 2020 at 22:37, Joachim Breitner <<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>I really would prefer a design where all these questions do not even<br>need to be asked…<br></blockquote><div><br></div><div>Me too. Also what about (.x) vs. ( .x), are those the same?<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">So I think to have the full picture, we need the following option as<br>well on the ballot:<br><br> 5. .x is a postfix operator, binding exactly like application,<br>    whether it is naked or not.<br>    (This is option 3, but without the whitespace-sensitivity.)<br></blockquote><div> <br></div><div>[...]<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Anyways, now for my opinion: Assuming no more options are added, my<br>ranking will be<br><br> <span> </span>5 > 4 > 2 > 1 > 3<br><br>This puts first the two variants where .x behaves like an existing<br>language feature (either like function application or like record<br>updates), has no whitespace sensitivity, and follows existing languages<br>precedence (JS and OCaml, resp.).<br>Then the compromise solution that simply forbids putting spaces before<br>.x (so at least the program doesn't change semantics silently).<br>I dislike variant 3, which adds a _new_ special rule, and where adding<br>a single space can change the meaning of the program, so I rank that<br>last.<br></blockquote><div><br></div><div>I'm also against whitespace-sensitivity and I lean towards this ordering too.</div>But I'm going with:<br><div><br></div><div>5 > 2 > 1 > 4 > 3</div></div><div class="gmail_quote"><div><br></div><div>Rationale: (5) seems the easiest to explain and has the fewest special cases, yet covers the use-cases we're interested in. Beyond that I want to be conservative because I find it hard to predict the ramifications of the more-complex alternatives 4/3, so I've put 2/1 ahead of those. I've made my peace with the current record selection syntax binding more tightly than application, and indeed I often rely on it to avoid a $, so I'm OK with 4 over 3.</div><div><br></div><div>Cheers</div><div>Simon</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><br>Cheers,<br>Joachim<br><br><br>PS, because its on my mind, and just for fun:<br><br>Under variant 3, both foo1 and foo2 typecheck, they do quite different<br>things (well, one loops).<br><br> <span> </span>data Stream a = Stream { val :: a, next :: Stream a }<br><br> <span> </span>foo1 f s = Stream (s.val) (foo1 (fmap f s).next)<br> <span> </span>foo2 f s = Stream (s.val) (foo2 (fmap f s) .next)<br><br><br>--<span> </span><br>Joachim Breitner<br> <span> </span><a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a><br> <span> </span><a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.de/</a><br><br><br>_______________________________________________<br>ghc-steering-committee mailing list<br><a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br><a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br></blockquote></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">ghc-steering-committee mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><a href="mailto:ghc-steering-committee@haskell.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">ghc-steering-committee@haskell.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a></div></blockquote></div><br></div></div></blockquote></div></div>