Sampling algorithms for D

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Apr 18 11:00:44 PDT 2012


On 18/04/12 18:54, Dmitry Olshansky wrote:
>> I can't comment very much, being myself quite noob, but I think you can
>> do this, for style as well as performance:
>> - add pure nothrow everywhere you can.
>
> Yup, unless it's a template as its properties are deduced anyway.

I really don't see anywhere I can do this -- every function is either inherently 
impure (it calls random number generation), calls an impure function, or relies 
on data external to itself (though not external to the struct).

>> Also not sure the _ convention for private attributes is recommended in D.
>
> It's OK. The c++ is where it's questionable and primarily because it may collide
> with some internal macros of you compiler! (__cplusplus anyone?)

Re the _variables, I just copied the convention already present in std.random, 
which I presumed was how it was supposed to be done ... :-)


More information about the Digitalmars-d-learn mailing list