Open bakkdoor opened 15 years ago
Changing the name is actually the smallest part of the problem - we also need to create a static "slot table" (fast) or hash table (slow, but more flexible) to store the instance variables.
For now I think I'd like to go with a slot table like the vtable, and just count the number of '@' var's that are mentioned in the class definitions. This will not be sufficient when we look at adding support for eval() (and also instance_variable_set, as well as instance_eval, possibly more), but for now there's no way for the code to increase this, so worst case it will over-allocate space.
There's the added wrinkle of supporting #defined? but that can be handled by creating a specific value to mean "undefined"
For class variables the solution would be similar but not the same, since class variables are shared with the subclasses of a class (while class instance variables are not).
i started to work on dealing with class & instance variables. you might want to take a look at my branch for that, as i'm still unsure, if my approach is actually ok.
gcc will not compile variable references that start with an at-sign (@). need to change names of instance and class variables to something else, for example: @var = classnameinstancevar @@var = classnameclassvar
or something similar.