On 05/02/2012 04:50 PM, Paolo Bonzini wrote:
Il 02/05/2012 22:00, Anthony Liguori ha scritto:
Classes are first class objects and can contain members, but I don't
know of any system where you actively look at the same field in a
super class for each class in the hierarchy. That's really trippy.
Just because it's new to you. Smalltalk has been doing that for 30-odd
years.
Ok, I've played around quite a bit with Python now and you are right. But I
still don't like what you're proposing. I have two main reasons:
1) I think it's too clever. I understand you disagree and this wouldn't be a
sticking point for me but nonetheless, I want to register that compliant :-)
2) If you do introspection in this method, it means that *all* properties have
to be registered as static properties to be introspected. That's a blocker for
me. We're always going to need to do the object_new() + enumerate +
object_delete() trick in order to introspect non-static properties.
Of course the VM has a lot of caching going on, but it's entirely
internal.
If we move properties to Object, I'd rather just stick a property
pointer in TypeInfo and call it a day. I'm not thrilled about it, but
I feel a lot better about it the above.
What if we add declarative links or children, for example? Adding more
junk to TypeInfo is not the solution.
Yes, I dislike this too. It was a suggestion of a lesser evil although in
retrospect, it's not much less of an evil.
Regards,
Anthony Liguori
Paolo