View previous topic :: View next topic |
Author |
Message |
simhau
Joined: 06 Feb 2007 Posts: 55
|
Posted: Mon Jan 14, 2008 8:18 am Post subject: Function pointers and delegates |
|
|
Doesn't MiniD support function pointers and delegates? I have several functions that uses this, but cannot bind them to MiniD. I have to create alternative methods that takes an MDClosure as parameter for it to work.
I couldn't find them listed in http://dsource.org/projects/minid/wiki/API/Introduction#TypeConversion |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Jan 14, 2008 10:25 am Post subject: |
|
|
So you have a function like:
Code: | void foo(int function(int) funcptr) |
or something, and you've bound foo, and you want to call it from MiniD with i.e. a MiniD function?
Definitely not supported right now. The issue is pretty much the same as the inheritance issue: if I wrap an MDClosure inside a native function as would have to be done here, there's no way to know which MDState to call the closure with when this native function is called. Again, this is something that should be possible with the redone interpreter in MD2. |
|
Back to top |
|
|
simhau
Joined: 06 Feb 2007 Posts: 55
|
Posted: Mon Jan 14, 2008 10:47 am Post subject: |
|
|
Yeah, something like that.
It was for my event functions that have the signature
EventSignal!(Widget, Event) keyUpEvent;
EventSignal in turn is a struct with bool delegate(Args) members witch in turn created problems with binding to MiniD.
But I've fixed this by adding some minid knowledge to a couple of classes and a few helper methods.
Sounds like MD2 will have a much better integration with D and in my little experience it already is very simple and supports a lot. |
|
Back to top |
|
|
|