On Fri, 2010-11-12 at 23:14 +0300, Dmitry Olshansky wrote:
[ . . . ]
> > I have a thread creation loop:
> >
> >          foreach ( i ; 0 .. numberOfThreads ) { threads[i] = new Thread ( 
> > bind (&  partialSum , 1 + i * sliceSize , ( i + 1 ) * sliceSize , delta ) ) 
> > ; }
> >
> I'd try to replace bind with delegate:
> threads[i] = new Thread( (){ return partialSum(1 + i * sliceSize, (i + 
> 1) * sliceSize, delta); } );
> 
> I'm not sure if std.bind works now, and why we even need it in D2 since 
> it's functionality is completely superseded by delegates.
> Well if Q was about D1...
[ . . . ]

I will certainly give using an anonymous function in this way a go, but
if partial application is a part of the language (and I am using D
2.050), then it ought to work. 

Sadly, using an anonymous function my code compiles, but on execution
just gives a segmentation fault.


[Thread debugging using libthread_db enabled]
[New Thread 0xf7d1fb70 (LWP 13922)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7d1fb70 (LWP 13922)]
0x0804ee0a in _d_monitorenter ()



-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to