Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Instead of everyone doing something differently, everyone can just comply with UUID.

With which UUID ? UUID v1 ? UUID v2 ? UUID v3 ? ... UUID v7 ?



UUID has the version number and variant number encoded in the generated UUID. You can just examine the UUID to determine which version it is.


The UUID specs are still confusing (or at least were to me lol) because the words "version" and "variant" both just say that something changes, not what is changing or why it's changing.

version from Latin vertere "to turn, turn back, be turned; convert, transform, translate; be changed"

variant from Latin variare "change, alter, make different,"

In my own UUID/GUID code I have taken to calling them "behavior" and "layout", respectively: https://github.com/okeeblow/DistorteD/blob/NEW%E2%80%85SENSA...


4.1.1 The variant field determines the layout of the UUID. That is, the interpretation of all other bits in the UUID depends on the setting of the bits in the variant field. As such, it could more accurately be called a type field; we retain the original term for compatibility.

4.1.3 The version number is in the most significant 4 bits of the time stamp (bits 4 through 7 of the time_hi_and_version field). The following table lists the currently-defined versions for this UUID variant. The version is more accurately a sub-type; again, we retain the term for compatibility.

It's recognized in the RFC and all you've done is broke compatibility for fashion.


Naming != compatibility. Nobody should be looking at my code except for me and it helps me remember it better so I'm not sorry 8)


Unless the random bits don’t follow those conventions.


It isn't a UUID if it doesn't contain those flag bits in their expected positions. A "random" UUID has only 122 bits of randomness for this reason.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: