On Thu, Jul 16, 2020 at 11:50 PM burak serdar <bser...@computer.org> wrote:

>
> [_ _] is ambiguous though, because _ is also an identifier character.
> [_x_] can be parsed as indexing with identifier _x_
>

Yes, _int_ is an allowed identifier in Go.  However per the suggestion at
the top of the present thread the compiler already knows where [ and ]
signify a generic.  So if the user wants to use an identifier that begins
or ends with a _ then in those spots the user must include the _ rather
than have gofmt add it.  (Since gofmt would add a _ if there is no leading
or trailing _ at those spots but wouldn't add one if there is one.)

In other words if you want to use the identifier _x then you would end up
with [__x_], if you want to use the identifier x_ then you would end up
with [_x__] and if you want to use the identifier _x_ (which is allowed in
Go) you would write [__x__].

I think this is rare.  Keep them coming!  More corner cases?

-- 
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/CAFwChBmQ448PCq-sakg1X3GFtERu9SvdgGmU-E4ZwCMSoyLhoA%40mail.gmail.com.

Reply via email to