Skip to content
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

GCC cant handle names that start with "@" #4

Open
bakkdoor opened this issue Apr 23, 2009 · 2 comments
Open

GCC cant handle names that start with "@" #4

bakkdoor opened this issue Apr 23, 2009 · 2 comments

Comments

@bakkdoor
Copy link
Contributor

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 = __classname__instance__var
@@var = __classname__class__var

or something similar.

@vidarh
Copy link
Owner

vidarh commented Apr 24, 2009

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).

@bakkdoor
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants