A little of coordination for Rosettacode

bearophile bearophileHUGS at lycos.com
Wed Feb 26 03:24:57 PST 2014


Ali Çehreli:

>Improve at will! :p

I will mostly just uniform its formatting to all the other 
Rosettacode entries, shorten the lines to 72 chars, etc.


>                 synchronized {
>                     // Switch to the next printer
>                     printers = printers[1..$];
>                 }

This doesn't work:

printers.popFront();


>     void print(string line)
>     {
>         enforce(ink != 0, new OutOfInk);
>         writefln("%s: %s", id, line);
>         --ink;
>     }
> }
>
> struct PrinterRendezvous
> ...
>             try {
>                 synchronized {
>                     
> (cast(Printer)printers.front).print(lines.front);
>                 }

It it a good idea to define Printer.print like this to remove 
that cast?

void print(string line) shared

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list