-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Suggest uppercase #3
Comments
Bullet point 5 of ULID spec reads, in part: "Uses Crockford's base32". |
I think the spec should explicitly note that. |
I'm also pretty sure very few implementations will respect this. And although the spec explicitly mentions Crockford's Base32 (which allows for hyphens ( I have implemented both (allowing |
Resolves #150 This is a simple solution for following issues * #78 * #57 * #143 * ulid/spec#57 * ulid/spec#3
case-insensitive is for codec only, but not for all other case (like db pk, redis key), please specify (at least prefer which case) the case, otherwise the db may not found the "same" ULID. BTW, I prefer lowercase, because in web env, most of time are case-insensitive, use lower case make more sense, like pg gen_random_uuid in lowercase. |
I don't see why the spec would have to define / enforce something as simple as upper/lowercase. If you have a specific usecase where you require either one, then call a |
from https://datatracker.ietf.org/doc/html/rfc4122#section-3
UUID specified the output case here, the underlying codec is not ulid, the output is. Without consistency on case, we can not just call |
What they do is up to them, isn't it?
I'm not sure I understand what you mean here. You mean the underlying encoding I guess? GUID's are case-sensitive in most languages AFAIK too. To me, I don't see why we would enforce either lower or upper case; it's trivial in most cases where it matters to make the ULID upper- or lowercase. I can see that agreeing on a canonical notation would be beneficial, but the benefits are minor and next to none IMHO. So my reasoning then is to leave it up to whomever uses it and their usecase. There's no real technical reason to enforce either notation IMHO.
If it really matters then why not create a wrapper/proxy/adapter/derived class that handles the upper- or lowercasing for your specific usecase? Shouldn't be more than a few lines of code in most languages. I know, you could argue that it costs extra CPU cycles to uppercase an entire lowercase string or vice versa and is wasteful if you can just output the correct case directly. So then let's argue we choose lowercase as 'canonical form' and then still, from the cases where casing does matter, 50% will have to run it through uppercasing methods; and if we choose uppercase then the other 50% will have to do the same... |
I just saw that there are implementations of ULID that provide uppercase only ULIDs, others (like the PHP implementation by @robinvdvleuten) provide lowercase ULIDs. The specification does not yet impose uppercase or lowercase but states that ULID is "case-insensitive". This is a great feature.
Nevertheless, I'd like to propose suggesting Uppercase ULID as "the right way". Mainly for two reasons:
I understand that this is debatable, as being flexible in your setup is a strength. But I also think, that having either uppercase or lowercase as the proposed (or imposed) way to implement ULIDs will help the Spec to spread because there is less potential for conflicts.
What do you think of this?
The text was updated successfully, but these errors were encountered: