-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Shorten type "Dynamic" to "Any" #944
Comments
This comment was originally written by [email protected] Removed Type-Defect label. |
I think "Any" is more descriptive. "Dynamic" implies other things are not dynamic, whereas they are simply more constrained. |
This comment was originally written by [email protected] I worry that Any sounds too much like Object, in that it sounds like it's the root of the type system. People might think that Any is just a synonym for Object, and think that its purpose is to hold any value, just like Object can hold any value. |
This comment was originally written by [email protected] Another word that might work well is "Wild". It's short, and also clearly conveys that the difference from Object is that variables of type Wild are not subject to any static checking. |
This comment was originally written by @seaneagan A couple more options to consider: '_' |
This comment was originally written by [email protected] The word "Unknown" appears multiple times in the Language specification to describe Dynamic. "The type Dynamic denotes the unknown type.". The language specification tells you what the keyword should be. |
This comment was originally written by @seaneagan Of course Object#dynamic should be renamed to match the new type name as well. However, I wonder if generic type casting syntax would be better: (Dynamic) expression which allows casting to any type, not just Dynamic. |
This comment was originally written by [email protected] 'dynamic' implies to me something happening at 'runtime'. Whereas in fact at runtime (production mode) type annotations are not used at all. Also with 'any' i can build a mental model of how the type system works: var x; // typed to any But if I really want x to be bind to other non-int values at some later point in the code i would declare x as follows: any x = 2; // typed to any 'any' - hits the sweet spot between succinct but readable - while enabling developers to build a mental model of how the semantics hang together. N.B - any should anyways be used rarely. Only if the developer really wants a duck type. |
This issue was originally filed by @seaneagan
"Any" has the obvious advantage of being shorter, and seems no less descriptive.
The text was updated successfully, but these errors were encountered: