[Mono-list] late linking & dynamic invocation ...

Ravi Pratap M ravi@ximian.com
26 Jun 2002 11:28:37 -0500

Hi Michael,

	Good to see you are hanging out with us in mono-land :-)

On Wed, 2002-06-26 at 10:58, Michael Meeks wrote:
> 	a) A way to specify that a certain object is extremely late 
> 	   linked, such that I can invoke arbitrary methods on it, and
> 	   the compiler will do ~no checking eg.
> 	LateLinkType t = (LateLinkType) myObject;
> 	t.unknownMethod ("astring");

	Using the Reflection API is what I would say and as you suggest
yourself but quite honestly I really don't quite follow what you are
trying to do :-) Perhaps you would care to explain it in a manner more
succint ?

> 	b) A way to handle delegates that is elegant; eg. I wish to
> 	   implement the following (or similar):
> 	private void sizeAllocate (Widget w, Allocation a,
> 				   Object closure);	
> 	...
> 		w.addHandler ("size_allocate", sizeAllocate, myObject);
> 	   I don't mind doing a (redundant) new Foo (sizeAllocate), and 
> 	I can see how you can do this with loads of delegates: new 
> 	DelegateWidgetAllocation (sizeAllocate) eg. but I don't want to
> 	go around typing the method signature twice - once in declaring 
> 	it, and once in a delegate allocation scheme.
> 	   Is it possible to coerce the type information out of a method
> 	name by some clever casting ? and if so, how in the (seemingly 
> 	unexpandable) delegate constructon scheme ?

	I don't think you can get at this information in any way but by using
the Reflection API once again but that would need the name of the type
at the minimum and no, not using any clever casting from a method name.

> 	Seemingly I've missed the plot somewhere here :-)

	And I the whole point of what you are trying to do so perhaps it's best
to ignore my rambling ;-)