FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Function pointers and delegates

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
simhau



Joined: 06 Feb 2007
Posts: 55

PostPosted: Mon Jan 14, 2008 8:18 am    Post subject: Function pointers and delegates Reply with quote

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
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Mon Jan 14, 2008 10:25 am    Post subject: Reply with quote

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
View user's profile Send private message
simhau



Joined: 06 Feb 2007
Posts: 55

PostPosted: Mon Jan 14, 2008 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group