While .toText() standard library method is not supported for the values of a user-defined identifier type, logging identifier values is still possible.
What is the serialisation format, if any, for an identifier in:
The motivation for the question is whether or not a separate uuid() function in a Strings contributor library would be useful over and above the existing identifier in NPL.
One of the key issues is whether or not external applications can “see” the UUID String value of NPL identifiers.
From your answer, it looks to me like they can and so there is not as strong an argument for a separate uuid() function.
However, one other question would be can client apps rely on the underlying UUID for an NPL identifier not to change with future platform releases? If not, then I guess this is probably a deal-breaker and a uuid() function is needed after all.
So, my understanding is that you want to “unwrap” the value to a plain UUID.
I think, it was deliberate to keep these values “opaque”, as in the key value itself (currently a UUID) is only valid in conjunction with its type, similarly as for symbols, .e.g. chf(10) != eur(10).
As to the value itself, currently it is UUID, … and I remember vaguely discussions on “opening” this to other (customer-defined?) value types (e.g. IBAN’s and the likes… )
That said, I can’t tell if offering a uuid() in a library is reasonable (as it seems to go against this “opacity” idea…).
p.s. I’m linking @Milos and @Ari - hoping they’ll have a more qualified opinion…
and also, bring it up in the NPL council?
Yes, the point with identifiers was that you can create them only via creating a new one and not by parsing a UUID. Exactly for the reason that they are tied to their types, as @Amela_Prelic mentioned. .toText() is not available as it would suggest that you can compare them e.g. on these values. There is also no .fromText. With that it mind, I am also not sure what the use case for UUIDs you have in mind. Depends on your needs.
My motivation is that I was asked to add a uuid() function to the Strings contributor library and I’m wondering if it’s necessary, given the identifier type.