std.concurrency, speed, etc.
bearophile
bearophileHUGS at lycos.com
Fri Feb 4 10:47:31 PST 2011
Adam Conner-Sax:
> I wrote the tester as an exercise in learning D. The language is great;
> perfect for me as someone who loved generics in C++ but found that all the
> cool things you could do got ugly and messy fast.
Few notes on the form of your code:
- I suggest to use module names all in lowercase
Some alternative ways to write some of your code:
auto sum = reduce!("a+b")(0.0,latency_data);
==>
auto sum = reduce!q{a + b}(0.0, latencyData);
auto sd = reduce!(f)(0.0,latency_data);
==>
auto sd = reduce!f(0.0, latencyData);
Test_Parameters[] tests;
tests ~= Test_Parameters(1,10,0,0);
tests ~= Test_Parameters(4,10,0,0);
...
==>
auto tests = [TestParameters(1,10,0,0),
TestParameters(4,10,0,0), ...
immutable int[] widths = [11,10,10,10,10,10,10,10];
==>
enum int[] widths = [11, 10, 10, 10, 10, 10, 10, 10];
debug (5) { printf("Rec'd: (pkt %i) %.*s\n",received,QT.package_tostring(p)); }
==>
debug(5) printf("Rec'd: (pkt %i) %.*s\n", received, QT.packageToString(p));
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list