-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add proper declarations #33
Comments
@effectfully, #13 mention external variables. Are declarations four bound variables, or do we declare free/external variables as well? |
Declarations are only for free/external variables. For a bound/internal variable we can annotate its rhs with a type at the definition site (or not do that if the type is unambiguous, which is currently probably always the case). So we need declarations precisely because those external variables are not bound anywhere and we have to specify their types somehow. And it also helps readability to declare all external variables upfront. |
Right, because we do not have functions, and we cannot properly specify an interface or an entry point to the program. I think that once we add functions then we get rid of declarations by specifying which function is an entry point of the program, and then specifying that functions arguments. Circling back to #51, do we want to
|
That's an interesting perspective, I haven't thought of it. We can have the same convention as in Haskell: That means that we'll have to distinguish between functions and procedures, though. Just like we distinguish between expressions and statements right now (which is something that we have to do, because assertions can only be compiled when they're at the top level, see this comment, so "statements" arise naturally). I.e. you can call a function (that can't contain any statements) only from an expression and a procedure (which is a bunch of statements) call is a treated as a statement. In that sense a I now think we should start with #51 first, otherwise it's too hard to change the language so that the changes make sense right now and after we fix #51. What do you think? |
Ok, I will focus on #51 first. |
Fixed by #79 |
Now that we plan to add arrays and functions, distinguishing between variables of different types by means of weird syntactic tricks is no longer an option, we need proper type signatures.
The text was updated successfully, but these errors were encountered: