std.uuid is ready for review
Jonathan M Davis
jmdavisProg at gmx.com
Fri Feb 10 15:14:50 PST 2012
On Friday, February 10, 2012 16:36:48 Robert Jacques wrote:
> These functions are _constructors_; ideally, they should be expressed as
> such. In a managed language, we'd probably for with UUID("random",...).
> And if explicit template ctors were valid syntax, we'd used
> UUID!"random"(...) or UUID!Mt19937() or UUID!randomNumberBased or
> something. There's also the enum/aliases, i.e. UUID(UUID.random) or
> UUID(Enum!"random") or UUID(UUID.Version.randomNumberBased). And at least
> for random, overloading works decently well, i.e. UUID(mySeed) or
> UUID(Mt19937(unpredictableSeed)). My point, or lack thereof, was to
> brainstorm ways of expressing a large variety of construction routines
> _as_ actual constructors.
A factory function is vastly better than any of those suggestions IMHO. I see
no problem with having randomUUID as a free function, and I really think that
it's best as-is.
- Jonathan M Davis
More information about the Digitalmars-d