By the way there must be a name for what I'm trying to do, is it "object introspection"?
More like "breaking encapsulation".
The whole point of classes and objects is polymorphism. That is, given an object, you don't care what its specific type is as long as it supports the operations you want to perform on it in a meaningful way.
In your specific case, there's a perfectly good way to get that instance data without relying on package variables or symbolic references or even caring about the specific type of the class. That way is calling a method.
With only a couple of classes, it might look like you're duplicating data by overriding methods. Maybe so... but it takes little imagination to see an expanded system with more subclasses, some of which can reuse their parent data (and good luck coding around that by accessing package variables symbolically!) and others that can override the parent method to call it and add, delete, or modify just one particular field in the results.
You're making a lot more work for yourself trying to work against the object system. Embrace it!
In reply to Re^3: displaying package variable from inherited method.
by chromatic
in thread displaying package variable from inherited method.
by wazoox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |