RFC: std.uuid

Johannes Pfau spam at example.com
Thu Dec 22 15:12:06 PST 2011


I've finished the port of boost.uuid to D and I'd hope to get some initial 
feedback.

Quoting the module documentation:

This is a port of boost.uuid from the boost project with some minor 
additions and API changes for a more D-like API.
A UUID, or Universally unique identifier, is intended to uniquely identify 
information in a distributed environment without significant central 
coordination. It can be used to tag objects with very short lifetimes, or to 
reliably identify very persistent objects across a network [...]

Documentation:
http://dl.dropbox.com/u/24218791/d/src/uuid.html

Source Code:
https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.rl
https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.d

There's one special thing about this module: It uses the ragel 
(http://www.complang.org/ragel/) state machine compiler. I hope this is not 
a problem for phobos, ragel doesn't introduce any runtime dependencies and 
has no effect on licensing. There's also no need to integrate ragel in the 
build process. We can publish a pregenerated .d file, which should be 
updated manually whenever changes to uuid.rl are made.

This module also depends on Piotr Szturmaj's crypto library to generate 
level 3&5 UUIDS. The code for this is written, but wouldn't be included in 
phobos until official SHA1 and MD5 implementations are in phobos. Swapping 
the MD5/SHA1 implementations against a different implementation should be 
very easy.

Some things I'd especially like feedback for:
* I'd really like to get suggestions for type/function names. Should the 
UUID struct be UUID/uuid/Uuid ?
* the names nameMD5UUID/nameSHAUUID look especially ugly. ideas?
* comments on typos/language etc


More information about the Digitalmars-d mailing list