[Mono-list] late linking & dynamic invocation ...
Michael Meeks
michael@ximian.com
26 Jun 2002 16:58:54 +0100
Hi there,
Apologies for arriving so late with my clueless questions; anyway -
I've been poking around with delegates, and they seem quite pleasant,
but inadequate for what I need.
I suppose I need to know how to do 2 things, and search as I do I can't
seem to see how to do them:
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");
The above being 'useful' for a stubless ORB. Of course,
perhaps it's possible that I have to have all the type
information there at compile time and it's not possible to have
a stub-less CORBA wrapper. I can see how the skel-less process
works, we do a GetType (), find the MethodInfo, and do an Invoke
but how should the stub case work ?
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 ?
Seemingly I've missed the plot somewhere here :-)
Thanks in advance,
Michael.
--
mmeeks@gnu.org <><, Pseudo Engineer, itinerant idiot