On 02/11/2012 12:26 AM, Tobias Pankrath wrote:
Jonathan M Davis wrote:
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
randomUuid it should be.
No.
Also see http://www.d-programming-language.org/phobos/std_utf.html