New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: Go 2: spec: expand reserved keywords list to include: true, false, nil #25490
Comments
That would break Go1 code so this would probably need to wait for Go2, pending approval. |
@andizzle, I'll loop in @griesemer for his wisdom |
This is a dup of #18193; which includes an explanation for this design decision. |
If anything, we want to remove keywords if at all possible. Again, see #18193 for the details of the discussion. If you want to write I'm going to close this as there's zero chance of this getting adopted. It also doesn't solve any real problem. |
@griesemer just want to point out the Python example given in #18193, is no longer the case in Python 3.
Thanks for point out that this is a design decision, that's all I'm looking for. |
@andizzle Thanks for the update. The question really is: Is it worthwhile to add more keywords, which then have to be mentioned in the respective expression grammar, and which have to be explained in the spec, simply to protect against people doing Or looking from a different angle: If we were to disallow There's plenty of opportunity for mischief in Go (and any language for that matter) - and these examples are things people don't really do accidentally in the real world. They do these if they want to prove a point or, well, create trouble (for themselves or others). We can't prevent this and thus we don't even try in these cases. Thanks. |
PS: There's a different design argument that could be made if |
Agree. If people want to write This is unlike some cases in other languages where if you don't know about them, you can be tricked. If people deliberately write Thanks again for clarifying this. |
Should this be allowed? https://play.golang.org/p/_ige_iHPQEn
The text was updated successfully, but these errors were encountered: