logoalt Hacker News

vbezhenartoday at 6:58 AM3 repliesview on HN

UUID is just array of 16 bytes or two 64-bit ints. Generating UUIDv4 is like few lines of code. Is that a big deal? I don't think so.


Replies

computomatictoday at 7:30 AM

16 random bytes is not a valid UUIDv4. I don’t think it needs to be in the standard library, but implementing the spec yourself is also not the right choice for 99% of cases.

show 4 replies
danishanishtoday at 7:26 AM

I think it saves labor and eventual bug hunting to include these in a stdlib. We should not be expected to look up the UUIDv4 spec and make sure you’re following it correctly. This feels like exactly what reasonable encapsulation should be.

Razengantoday at 10:08 AM

You can say this for everything that has built-in support.

show 1 reply