ULID (Universally Unique Lexicographically Sortable Identifier) in Ada

Just added an Ada implementation of ULID (Universally Unique Lexicographically Sortable Identifier), basically a combination of a time stamp and a random number.

6 Likes

Great work! Do you plan on adding the monotonicity and byte order portions of the specification in a later update(s) or is this something we need to implement on the client side? No problem either way, but wanted to know for future planning.

The monotonic variant is just in:

Also the network byte order is implemented:

Oh nice! Great work again!

For some reason this doesn’t compile with 64-bit ObjectAda. I tried to make a version that would compile with it, but it failed with Time_Error, because Duration'Last is a bit over 131000. I created a function to calculate the time in milliseconds between now and the Unix epoch, but then I ran into what seem to be compiler errors, though not consistent enough to generate an error report.

I tried a different approach and managed to produce a version that works with ObjectAda 10.5. Found and reported a problem with Discrete_Random in the process.

1 Like

Some news on this small crate:

  • UUID 8-4-4-4-12 text output like “01920161-d64d-5a3e-589e-c45df155547b”
  • Conversion from text representations to 128-bit numbers

Alire: Alire - Ulid
GitHub: GitHub - zertovitch/ulid: ULID implementation in Ada
SourceForge: ULID-Ada download | SourceForge.net

4 Likes

This is really neat! Something I never heard of but which may be useful to me.

Can you put an example w/ generated ULID in the README? I didn’t know what one looked like, so I clicked “spec”. Then I noticed your implementation is not listed there. I strongly suggest you submit a PR to add yours to the table: spec/README.md at master · ulid/spec · GitHub

Great work! :tada:

Hey @theruran!

Welcome here :slight_smile:

Best,
Fer

1 Like

Exellent idea → done!

1 Like

Already done for a while: Update README.md by zertovitch · Pull Request #95 · ulid/spec · GitHub
Unfortunately there are 5 years backlog.
It seems the author has lost interest…

1 Like