Closed kilianmh closed 3 months ago
IMO string is only used when converting from/to some external format. Otherwise I'd like to work with the uuid type. Not sure if additional constructors will confuse the user.
While I wouldn't necessarily call this cumbersome, I agree that it is common enough to be a useful addition to the API (especially when you need pass a function argument). If we add this then all supported conversions should be considered (integer, octets, symbol and string).
I prefer the name make-vN-TYPE
(make-v1-octets
, make-v4-integer
, make-v7-sym
, etc.) and the functions should probably be defined in the respective files for each UUID version (this would be non-frugal/name-based.lisp
for versions 3 and 5).
Having multiple constructors shouldn't be too confusing I think, we already have them in the current API (e.g. make-v7-from-timestamp
).
At some point these could be optimized to avoid some allocations as well.
@kilianmh I hope this works for you: https://github.com/ak-coram/cl-frugal-uuid/commit/c310845c472ea214a60477fb8e33d168041a1017
String is probably the most used form of
uuid
, but currently it is a bit cumbersome to produce:Should we introduce functions to directly output strings?
Here would be some obvious naming ideas:
make-v7-string
v7-string
make-v7-to-string
Or would you prefer a different name?