<div dir="ltr"><div>The treatment of ".x" as a postfix operator that binds more tightly than function application seems like a reasonable position to me. It accounts for <br></div><div><br></div><div> f r.x =>  f (r.x)</div><div><br></div><div>and also means that we can split a chain of record selectors over multiple lines. It does diverge from qualified name syntax, but I think that was already the case since we intend that the left-hand side of a record selection is an expression, not an identifier - in fact it would be an aexp in terms of the Haskell grammar.  So the new lexeme is the ".varid" record selector and we're only discussing what happens at the context-free grammar level.</div><div><br></div><div>Cheers</div><div>Simon<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 17 Dec 2019 at 11:46, Simon Peyton Jones via ghc-steering-committee <<a href="mailto:ghc-steering-committee@haskell.org">ghc-steering-committee@haskell.org</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">| I.e. I will support `f r.x = f (r.x)`, if I can still add space before the<br>
| .x.<br>
<br>
That gets into a separate question, the "naked selector" question.  There we have the following viable alternatives<br>
<br>
(1) .x is illegal<br>
(2) .x means (\r. r.x)<br>
(3) .x is a postfix operator<br>
<br>
Certainly (3) would all you to write<br>
        r .x .y        meaning r.x.y<br>
or<br>
        f (r .x .y)    meaning f (r.x.y)<br>
<br>
But I was trying to close the discussion of (f r.x) before opening the discussion about 1/2/3 for naked selectors.<br>
<br>
Simon<br>
<br>
-----Original Message-----<br>
| From: ghc-steering-committee <<a href="mailto:ghc-steering-committee-bounces@haskell.org" target="_blank">ghc-steering-committee-bounces@haskell.org</a>><br>
| On Behalf Of Joachim Breitner<br>
| Sent: 17 December 2019 10:33<br>
| To: <a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
| Subject: Re: [ghc-steering-committee] Records again<br>
| <br>
| Hi,<br>
| <br>
| Eric nicely summarizes my thoughts<br>
| <br>
| I am a happy user of<br>
| <br>
|   f r.x .y = f (r.x.y)<br>
| <br>
| in Ocaml, and I agree that it is not an absolutely horrible choice, and<br>
| will likely vote it over Reject.<br>
| <br>
| <br>
| I would find it bad, though, if we have<br>
| <br>
|   f r.x.y = f (r.x.y)<br>
| <br>
| but disallow or give completely different meaning (as in the bare .y<br>
| variants) to<br>
| <br>
|   f r.x .y<br>
| <br>
| (where the space could still be a newline). Record accessors can possibly<br>
| be deeply nested, so it should be possible to nicely wrap or vertically<br>
| align the code. This indicates that postfix .x should parse similar to<br>
| postfix `{x=1}` (what a nice coincidence that both relate to records).<br>
| <br>
| So while I fully understand the analogy to module qualifiers, this aspect<br>
| already makes them different.<br>
| <br>
| <br>
| In the end I am a big fan of the fundamental rule of mentally parsing<br>
| Haskell code, namely “function composition binds most tightly and<br>
| associates to the left”.<br>
| Yes, there are exceptions (qualified names, record updates).<br>
| And yes, variant “JS” and “JS+Section” are still a slight exception to that<br>
| rule (as there record accessors associate with function application).<br>
| <br>
| So maybe my current thinking is<br>
| <br>
|  JS+Section > JS > Ocaml+Section > Ocaml > SectionSelector<br>
|     > Reject > OnlySelection > PlainSelector<br>
| <br>
| <br>
| I.e. I will support `f r.x = f (r.x)`, if I can still add space before the<br>
| .x.<br>
| <br>
| I am not yet completely decided what to think of disallowing `f r .x`.<br>
| <br>
| <br>
| <br>
| Oh, and here is a nice way to justify the JS variants functionally. Not<br>
| sure if it is helpful… A record r with fields foo and bar can be thought of<br>
| as a _function_ with domain {.foo, .bar}. In that point of view,  the<br>
| syntax<br>
|    f .foo<br>
| <br>
| <br>
| <br>
| <br>
| Cheers,<br>
| Joachim<br>
| --<br>
| Joachim Breitner<br>
|   <a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a><br>
|   <a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.de/</a><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>
_______________________________________________<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>