On 1/13/23 07:20, Gorka Guardiola wrote:
According to the spec it seems like it is legal to shadow a type with a variable, even a builtin type. Is there any specific rationale for this? I guess that it makes scoping checks easier and faster, but still.


I don't think there is any special rationale behind it, in Go builtin types are predefined identifiers, not keywords as usual in other languages, thus those follow rules of identifiers, not keywords. Although it feels astonishing that you can shadow even predefined constants like "true := false", in my experience this haven't shown to be an issue.

-w

--
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/ff5efae5-937e-32dd-608a-8d8ac8d0417b%40104d.net.

Reply via email to