4 ms·
This is great, as much as interface{} is not great, it's still part of the language and really verbose/non-descriptive. I'm guessing any was a forbidden word?
by baby 5y ago
This is great, as much as interface{} is not great, it's still part of the language and really verbose/non-descriptive. I'm guessing any was a forbidden word?
- mseepgood 5y ago> I'm guessing any was a forbidden word? You mean a reserved keyword? No, 'any' is not a keyword, it's an identifier (a predeclared identifier). The usual shadowing rules apply.
- shadowgovt 5y agoIt wasn't so much that `any` was forbidden as that `interface{}` practically meaning "any value" fell naturally out of Go's existing type system rules, so there was no need to introduce another concept. But having `any` as syntactic sugar for that concept is a good idea.