-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement Static Typing #48
Comments
Added static typing. Uniform now requires a declaration before an identifier can be used. Declarations must be put in the root scope and use the grammar I removed the Also made some minor edits involving adding |
I like the new change. After working through the car form tutorial, I was able to pick it up fairly quickly. Is vs equals was already confusing so I'm glad the distinction is gone. You also mentioned adding integer, array, and date in this ticket. Do you want to add a separate ticket for those? Code review is done, but you can close this if new types are a separate ticket. |
Due to the issues encountered in #36, we will need to introduce explicit static typing. Every identifier would need to be declared with a particular type. Using an identifier without an associated declaration should result in an
UndeclaredError
. This would look like the following:In terms of types, we should probably have:
boolean
string
number
integer (should this be distinct from number?)
date (eventually, but this doesn't exist yet anyways)
We will also probably want to eventually support array types (probably not right now):
We have two options for scope, either 1) require that they be declared in the root scope, or 2) allow scoping the same way we do with variables. The first would effectively make all identifiers global (eww, but sort of the way it actually works behind the scenes). The second would compartmentalize better, but is a little strange in that the user may have to declare the same variable twice in two different scopes, which can be a somewhat counter-intuitive.
I think I'm leaning towards making identifiers inherently global as I think the extra confusion and complexity of allowing scope would outweigh the small compartmentalization benefit it provides. Thoughts @sawyernovak?
The text was updated successfully, but these errors were encountered: