-
Notifications
You must be signed in to change notification settings - Fork 21
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
FR - Infer type without declaration #36
Comments
So the reason for not having type inference is that variables without a type specified as inferred as ruby objects and all operations performed on them delegate to the Ruby interpreter. For example:
will translate to:
If we infer the type as a C type there will be no scope for assigning different objects to the same variable, which is possible in Ruby. |
Hey
I was not referring to that. I am no expert on AST or how you have actually implemented the Type System. Just a thought. |
You have a point. But the system you are proposing is quite advanced given the stage of development of Rubex. In order to implement what you suggest it will be necessary to perform two passes of the code for type inference: one pass that understands how every variable is used and the second pass that will infer the type based on the usage of variables whose types are unspecified. As of now I want to focus on building basic features that will make Rubex a go-to tool for writing Ruby C extensions and CUDA programming in Ruby. |
Hey
Just wanted to mention if it is feasible to modify the AST to infer variable type from the value it is set?
Currently, in C specific examples I was exploring, variables are declared.
Recently was looking into Mirah and their that is not required even if calling Java methods. It is more ruby like. It properly compiles to classes, without any penalty.
The text was updated successfully, but these errors were encountered: