H
Hakusa
I remember reading that, in Python, working with variables can be slow
because it needs to check if the variable is being changed to another
type every time it's used. I don't know if Ruby is like that too, but
this is for if it is.
If they make it possible for explicit variable definitions. Let's say
I've got an integer and there's no reason it would ever turn into a
float or anything like that unless specifically noted. It might run
faster because Ruby wouldn't have to mess with dynamic typing. And
I've got a class that has a variable that is a string. I could
immediately define it as a string the same way I would in C or Java.
Ruby wouldn't have to check the type AND THEN initialize, it would
already know the type!
But I'm guessing that if this would be useful, it would have already
been done. So am I right or can you tell me why I'm wrong?
because it needs to check if the variable is being changed to another
type every time it's used. I don't know if Ruby is like that too, but
this is for if it is.
If they make it possible for explicit variable definitions. Let's say
I've got an integer and there's no reason it would ever turn into a
float or anything like that unless specifically noted. It might run
faster because Ruby wouldn't have to mess with dynamic typing. And
I've got a class that has a variable that is a string. I could
immediately define it as a string the same way I would in C or Java.
Ruby wouldn't have to check the type AND THEN initialize, it would
already know the type!
But I'm guessing that if this would be useful, it would have already
been done. So am I right or can you tell me why I'm wrong?