hap.random: a new random number library for D
Joseph Rushton Wakeling via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sun Jul 13 08:40:31 PDT 2014
On Sunday, 13 July 2014 at 15:31:51 UTC, bearophile wrote:
> So creating a random number generator can't be @nogc?
I think even as things are there is nothing stopping the user
from manually allocating and using "emplace" to create an RNG
instance without relying on the GC. However, even if not, I
think this would be less of a problem, as in general things like
RNG instances can be expected to be allocated "high up" in the
program and passed down into the inner parts where @nogc becomes
a concern.
What really matters to me is stuff like Sample and Cover, where
we can readily expect that they may be called in inner loops of
the program, and so having lots of allocations via "new" would be
a big problem. So, it follows that the current helper functions
(sample, cover, etc.) need to be rewritten at some point with
this in mind.
It's not a problem I propose to solve for the 1.0.0 release, but
it is a problem that needs addressing in the long run.
Out of curiosity, do you have any ideas or suggestions for how to
address the requirement for RNGs and related functionality to be
reference types, together with the wish to support @nogc ... ?
Preferably in a way that avoids the user having to explicitly
indicate destruction?
More information about the Digitalmars-d-announce
mailing list