realthunder wrote: ↑
Mon May 04, 2020 11:07 pm
UUID is too long, expensive to manipulate comparing to simple integer, and most importantly, not unique at all, considering the user is free to duplicate the document and then copy object back and forth.
First thanks for responding. Some background, this discussion has a "long beard" and more or less i asked the question, due to reading FreeCAD now has a "getID method", for i guess uniquely identifying document objects, compered to dealing with the internal (human readable) name for such purposes. And AFAIK the document itself already uses UUID, as identifier. Anyway, i remembered some old discussions, and asked.
To me personally using UUID feels natural, mainly because this is what it was made for. The integer approach is i guess closer to on how Python keeps an ID of an object. Now i would say that the UUID is unique, and you can count on that, and that is basically on why i am a fan of the UUID. As for possibility of duplicating a document and getting a clash, for sure that can be a problem, for any unique identifier, being a simple integer or an UUID. Copy of a document object should get a new identifier? For that for sure there will always need to be some logic included, to deal with that. But as for the uniqueness of a short integer vs. UUID, here i feel that UUID does the job better.
P.S. Beyond stating this i am OK with whatever happen or doesn't happen next. I see this as a conclusion to that old discussions we had, about the possibility of introduction of an unique identifier for a document object, beyond using internal name.