On Wed, Jul 15, 2020 at 2:36 PM Randall O'Reilly <rcoreil...@gmail.com> wrote:
>
> Regarding the parsing: as I suggested in my email, but perhaps was unclear, 
> in case of two conflicting *purely syntactic* interpretations (without using 
> any type information), you could just choose the more high-frequency 
> interpretation (i.e., type parameters) and force the programmer to use 
> additional parens if they actually want the other interpretation.
>
> So in the case of the example, w < x, y > (z) is *automatically, 
> syntactically* interpreted as a function call using 2 type parameters, and if 
> you want it to be two different relational expressions, you have to wrap them 
> in parens: (w < x), (y > (z))
>
> This latter use is likely to be vanishingly rare (someone could run their 
> code analysis on it), so this seems like a small inconvenience.  Maybe there 
> are other such conflicts?  If this is the only one, I don't think it is 
> sufficient to rule out the use of < >.
>
> My mention of the point about gofmt was just that it should get rid of the 
> seemingly redundant extra paren around (z), but I just tried it and 
> apparently it does not, even with gofmt -s.  Anyway, the above point stands: 
> you CAN parse < > correctly by just making purely syntactic choices in the 
> case of conflicts, and this applies to all Go tools using the same purely 
> syntactic parsing pass.

That's true.  We could do that.  It's not backward compatible, and it
doesn't fit the Go 2 transitions plan, but we could do it if we really
had to.

But we don't really have to.  We can use square brackets instead, or
we can go back to using parentheses.  This thread suggests that while
clearly some people prefer angle brackets, it is not a dominant
consensus.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVo3d4zrXkGtxPzMUSC%2BJ0ju_B3DsQZj%2B%3D5Ec2%2B3y0%3DSA%40mail.gmail.com.

Reply via email to