http://wiki.dlang.org/DIP25

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 28 04:23:04 PST 2014


On 28/12/14 04:09, Andrei Alexandrescu via Digitalmars-d wrote:
> Walter and I have been working on revamping DIP25, which focuses on tightening
> the screws of ref. This should then simplify DIP69 significantly.
>
> Please comment: http://wiki.dlang.org/DIP25

How will that interact with designs like the singleton used in e.g. 
std.random.rndGen:

     @property ref Random rndGen() @safe
     {
         import std.algorithm : map, repeat;

         static Random result;
         static bool initialized;
         if (!initialized)
         {
             static if(isSeedable!(Random, typeof(map!((a) => 
unpredictableSeed)(repeat(0)))))
                 result.seed(map!((a) => unpredictableSeed)(repeat(0)));
             else
                 result = Random(unpredictableSeed);
             initialized = true;
         }
         return result;
     }

... will it be as simple as adding an 'inout' qualifier to the method and/or 
return type?  In any case I think it's a use-case worth adding to the example list.


More information about the Digitalmars-d mailing list