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.
    • Re: hap.random: a ... Joseph Rushton Wakeling via Digitalmars-d-announce
      • Re: hap.random... bearophile via Digitalmars-d-announce
        • Re: hap.ra... Dicebot via Digitalmars-d-announce
          • Re: ha... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... Dicebot via Digitalmars-d-announce
            • R... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... Joseph Rushton Wakeling via Digitalmars-d-announce
        • Re: hap.ra... Joseph Rushton Wakeling via Digitalmars-d-announce
          • Re: ha... bearophile via Digitalmars-d-announce
            • R... Joseph Rushton Wakeling via Digitalmars-d-announce
  • Re: hap.random: a new r... Chris Cain via Digitalmars-d-announce

Reply via email to