www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Tango bind functionality

reply Jason House <jason.james.house gmail.com> writes:
I've found http://www.dsource.org/projects/tango/ticket/396 which 
indicates that bind functionality is indefinitely postponed.  It's even 
marked as a closed ticket!

I'm in the process of porting code over from phobos to tango.  All I 
have left to do is resolve all of my calls to bind.

I'm using delegates as generic signaling between threads.  The problem 
is that creating a delegate on the fly (using {}) won't work in many 
cases.  Because of the async nature, the local stack frame won't be 
available and all accesses to variables are lost.  It's a real hack to 
manually create helper objects (with a constructor and opCall function) 
for simple things that can be replaced with bind(&foo.bar, a, b)

Even if not part of tango, does anyone have any generic tango-based 
solution for this?  (Note that the phobos implementation of bind does 
not work completely in gdc 0.23.  I'm hesitant to just copy the phobos 
implementation)
Jul 25 2007
parent reply Sean Kelly <sean f4.ca> writes:
Jason House wrote:
 I've found http://www.dsource.org/projects/tango/ticket/396 which 
 indicates that bind functionality is indefinitely postponed.  It's even 
 marked as a closed ticket!

The change was made around the time 0.99 was released, because no one had been asking about it. And we weren't in full agreement about whether or not it was a necessary feature. If you have a compelling use case, post it to the Tango forums and I suspect the decision will be reconsidered :-)
 Even if not part of tango, does anyone have any generic tango-based 
 solution for this?  (Note that the phobos implementation of bind does 
 not work completely in gdc 0.23.  I'm hesitant to just copy the phobos 
 implementation)

I actually have the revised version of bind that was slated for inclusion in Tango. You can ask its author (h3r3tic) for a copy as well. Sean
Jul 25 2007
parent reply Jason House <jason.james.house gmail.com> writes:
Sean Kelly Wrote:

 Jason House wrote:
 I've found http://www.dsource.org/projects/tango/ticket/396 which 
 indicates that bind functionality is indefinitely postponed.  It's even 
 marked as a closed ticket!

The change was made around the time 0.99 was released, because no one had been asking about it. And we weren't in full agreement about whether or not it was a necessary feature. If you have a compelling use case, post it to the Tango forums and I suspect the decision will be reconsidered :-)

That's now done.
 Even if not part of tango, does anyone have any generic tango-based 
 solution for this?  (Note that the phobos implementation of bind does 
 not work completely in gdc 0.23.  I'm hesitant to just copy the phobos 
 implementation)

I actually have the revised version of bind that was slated for inclusion in Tango. You can ask its author (h3r3tic) for a copy as well.

How do I contact them?
Jul 26 2007
parent Sean Kelly <sean f4.ca> writes:
Jason House wrote:
 Sean Kelly Wrote:
 
 Even if not part of tango, does anyone have any generic tango-based 
 solution for this?  (Note that the phobos implementation of bind does 
 not work completely in gdc 0.23.  I'm hesitant to just copy the phobos 
 implementation)

inclusion in Tango. You can ask its author (h3r3tic) for a copy as well.

How do I contact them?

I just put it online here: http://www.invisibleduck.org/~sean/tmp/Bind.d Sean
Jul 26 2007