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?
  • Re: hap.random: a new r... Nick Sabalausky via Digitalmars-d-announce
    • 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: ha... 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