I have some code (a simulation style solution to the Sleeping Barber problem). It uses spawned processes to represent the actors of the system. The code compiles and executes as expected using GDC as currently on Debian Unstable, which I believe is effectively D 2.057. Using DMD 2.058 I get the error message:
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(529): Error: cannot have parameter of type void /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(529): Error: cannot have parameter of type void /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(529): Error: variable std.concurrency.receive!(void delegate(Customer customer) @system,void,void).receive._param_1 voids have no value /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(529): Error: variable std.concurrency.receive!(void delegate(Customer customer) @system,void,void).receive._param_2 voids have no value Failed: 'dmd' '-v' '-o-' 'singleBarber_d2_spawn.d' '-I.' Using DMD 2.059 I get the error message: singleBarber_d2_spawn.d(35): Error: template std.concurrency.receive does not match any function template declaration /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(530): Error: template std.concurrency.receive(T...) cannot deduce template function from argument types !()(void delegate(Customer customer) @system,void,void) singleBarber_d2_spawn.d(59): Error: template std.concurrency.receive does not match any function template declaration /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(530): Error: template std.concurrency.receive(T...) cannot deduce template function from argument types !()(void delegate(Customer customer) @system,void delegate(SuccessfulCustomer successfulCustomer) @system,void delegate(ShopClosing message) @system,void delegate(ClockedOut message) @system,void) singleBarber_d2_spawn.d(99): Error: template std.concurrency.receive does not match any function template declaration /home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/concurrency.d(530): Error: template std.concurrency.receive(T...) cannot deduce template function from argument types !()(void delegate(Tid t) nothrow @safe,void delegate(Customer customer) @system,void delegate(SuccessfulCustomer successfulCustomer) @system,void,void) Failed: 'dmd' '-v' '-o-' 'singleBarber_d2_spawn.d' '-I.' the "offending" bit of code is: receive ( ( Customer customer ) { writeln ( "Barber : Starting Customer " , customer.id ) ; Thread.sleep ( hairTrimTime ( ) ) ; writeln ( "Barber : Finished Customer " , customer.id ) ; ++customersTrimmed ; shop.send ( SuccessfulCustomer ( customer ) ) ; } , ( ShopClosing ) { writeln ( "Barber : Work over for the day, trimmed " , customersTrimmed , "." ) ; shop.send ( ClockedOut ( ) ) ; running = false ; } , ( OwnerTerminated ) { } ) ; Where Customer and SuccessfulCustomer are structs as the case types -- so that the shop can distinguish new arrivals from trimmed customers. So somewhere between 2.057 and 2.058 it seems that something about receive changed, as far as I am concerned from correct to fail -- however I may have missed a memo... -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part