[IronPython] Need help to port-dynamic class generation code to IP2

Sakesun Roykiattisak sakesun at boonthavorn.com
Mon Apr 21 03:21:45 CEST 2008

Real thanks for your time and effort.

> The fact that __init__ isn't called is pretty strong evidence that
> part of the initialization process is being skipped when you call the
> constructor directly.  In the case of IronPython 1.x, this is
> apparently not fatal -- but not so IP 2.0.

In my actual implementation, I do call __init__ within the emitted class
by calling "InvokeSpecialMethod" inside the generated constructor.
Unfortunately, the method is no longer available in 2.0

> The normal construction process for a new object is triggered by a
> __call__ to the type object.  In 2.0, this gets handled by the method
> PythonCallBinderHelper<T>.MakePythonTypeCallRule, which generates the
> DLR expression tree that will actually implement the construction.  It
> doesn't look like it would look very easy to hook into this object
> creation process.

Hope that does not mean I'm doomed.
Anyway, thanks for the hint. I'll investigate what I can do.

> I take it that you need to provide the library with a Type object?

I do not completely understand this statement. I assume you suggest
me to extend PythonType to customize it's behaviour ?


More information about the Ironpython-users mailing list