-
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
Declare a variable with type #4
Comments
How do we freeze variable itself or check type at every reassigning? |
The declaration should be trivial, we probably don't even need local_variable for that, just make def int check it's argument. As for tracking the variable, at first look it seems impossible.. Without doing source inspection, I can't even think of a way to infer the name of the instance variable from def int But checking at declare time is probably good enough. Can you do String str; in Java? I know you can do public String str; in a class to declare members without assigning a value, so you can probably do that in local scope too? |
@chancancode Thank for adding me to the repo! I'm honored. I agree with you. It may be impossible or need dirty hack.
oh, you'er totally right. sorry it's my mistake ; ( |
Sorry if it wasn't clear (I was typing on my phone), the last point was more of a question. I just checked and answered my own question, you can indeed do all of these in Java: String a = "abc";
String b;
int c = 1;
int d; I suppose |
The text was updated successfully, but these errors were encountered: