[IronPython] Dynamic overloading of Reflected Methods

Dino Viehland dinov at exchange.microsoft.com
Mon Jan 16 23:22:04 CET 2006


This looks like a bug (or two).  We currently don't allow you to override reflected methods on a per-instance basis (or at least the C# side won't see it).  

We also don't allow you to construct bound ReflectedMethod's in the manner that you'd like.  Currently we only really expect the IronPython runtime to create reflected methods and so we'll need to fix that as well.

Unfortunately I don't think the changes will be quite trivial so I'll be a little surprised if we get this fixed for beta 2.  But it seems like it should work and that for now you have a reasonable work around until we get it fixed.  Thanks for the bug report!

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas
Sent: Monday, January 16, 2006 9:18 AM
To: users at lists.ironpython.com
Subject: [IronPython] Dynamic overloading of Reflected Methods

	hi,

	I'm trying to dynamically overload an objects methods
	with IP. Something like:

	class A:
             def test(self):
                 print "A"
         a = A()
         def newtest(self):
             print "newtest"
         testType = type(a.test)
         a.test = testType(newtest, a)
	a.test()

	prints "newtest" as expected. However I cannot overload
	a ReflectedMethod made in C# this way (or don't know how).

	A workaround for this, is to implement the methods in a
	derived class and override them them there. However these
	overloaded methods cannot be called. I have attached a
	C# and a Python file to reproduce this.

	Any Ideas? Is this supposed to work?

	l8r...
		Thomas



More information about the Ironpython-users mailing list