From: "Martin v. Loewis"
Christian Tismer
writes: Christian's additions (as far as I understand them :-) are mostly intended for very esoteric situations.
My additions support a subset of C++ virtual methods. How is that esoteric?
Why would an extension writer ever want to do this? "Normal" extension types either wrap some C type, so you don't have inheritance at all, or some C++ type, in which case a single type method can wrap arbitrary virtual methods (since the VMT is done in C++).
A real-world example would help.
Well, I want to do something like this, and I think it's for a fairly simple reason. All of my (dynamically-generated) extension classes need a piece of data which tells them how much extra data to allocate in the variable-sized area of their instances. This is an implementation detail which I don't want to expose to users. Right now I have to stick it in the class' __dict__, which not only means that it's exposed, but that users can change it at will. It also costs me an extra lookup every time an instance of the extension class is allocated. It would be much nicer if I could get a little data area in the type object where I could stick this value, but right now there's no place to put it. Chris' patch allows me to handle the issue much more naturally. It doesn't seem esoteric to add information to a type which doesn't live it its __dict__. Not being able to do so makes types very different from other objects. ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com Of course, that makes it esoteric by its very definition ;-)