泛型的新提议是否向后兼容旧版本
Is a new proposal of generics backward compatible with older versions
最近proposal about adding generic programming for Golang的许多新事物中有一个新关键字any
因此,如果我当前的程序声明了一个名为 any
的变量,它将无法编译。
in the recent proposal about adding generic[s ...] there is a new keyword any
.
错了。 any
将是预先声明的标识符,而不是关键字。
So if my current program has declared a variable named any it won't compile.
不,当然不是,它只会在当前范围内重新声明any
。
Go 中的关键字列表很短,参见 https://golang.org/ref/spec#Keywords . Keywords are keywords and cannot be used for other things. A predeclared identifier (see https://golang.org/ref/spec#Predeclared_identifiers) 不是关键字,可以重新声明。
最近proposal about adding generic programming for Golang的许多新事物中有一个新关键字any
因此,如果我当前的程序声明了一个名为 any
的变量,它将无法编译。
in the recent proposal about adding generic[s ...] there is a new keyword
any
.
错了。 any
将是预先声明的标识符,而不是关键字。
So if my current program has declared a variable named any it won't compile.
不,当然不是,它只会在当前范围内重新声明any
。
Go 中的关键字列表很短,参见 https://golang.org/ref/spec#Keywords . Keywords are keywords and cannot be used for other things. A predeclared identifier (see https://golang.org/ref/spec#Predeclared_identifiers) 不是关键字,可以重新声明。