The rationale, I understand, is that it helps with the Go compatibility 
promise: when new types / constants / functions are added to the language, 
they don't break existing code.

On Friday, 13 January 2023 at 10:22:46 UTC paurea wrote:

> These programs compile and work according to my reading of the spec, but I 
> found them surprising.
>
> https://go.dev/play/p/EUZ_28jge1N
> https://go.dev/play/p/NMhR1Nq1COw
>
> 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.
>
> More "interesting" programs in the same vein:
>
> https://go.dev/play/p/_KburW2YuCG
> https://go.dev/play/p/JTkvW7jsvyX
> https://go.dev/play/p/tDji-HNo1_W
> -- 
> - curiosity sKilled the cat
>

-- 
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/1b4cbc80-9399-4c0e-89cc-1bb53970cd1bn%40googlegroups.com.

Reply via email to