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 09:31:54 PDT 2014
On Sunday, 13 July 2014 at 16:24:29 UTC, bearophile wrote:
> Even if the 1.0.0 release of std.random2 is not much @nogc, in
> my opinion it needs to have an API designed to allow it to be
> retrofitted cleanly and nicely for @nogc usages too.
Completely agree. Incidentally the library is intended for use
with dmd 2.065+ which precludes unqualified use of @nogc for now,
but that will be addressed after 2.066 is released and ldc/gdc
upgrade their frontend/Phobos dependencies.
> If you are not using the GC, and you don't want to indicate
> destruction, you have to use RAII and perhaps RefCounted. You
> can allocate on the C heap manually, or on the stack, or you
> can allocate on the stack or C heap using one of Andrei's
> future allocators.
Stack allocation is arguably appropriate for stuff like Sample,
however, the created entity needs to be able to escape the scope
of the helper function which allocates it.
More information about the Digitalmars-d-announce
mailing list