How to intern UUIDs? :-)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to intern UUIDs? :-)

marcel.taeumel
Heyho!

The following line made me (somehow) expect to get the same instance of UUID as generated just before via "UUID new":

UUID fromString: '165fea06-1260-bf45-b6e2-43016456a4f8'.

:-D

Testing some object serialization (to/from Json) in combination with an IdentityKeyDictionary, I could not find the key, which is that UUID.

***

General question: Would UUID interning make sense? Could the UUID plugin do it? Do plugins have access to object memory?

Best
Marcel


Reply | Threaded
Open this post in threaded view
|

Re: How to intern UUIDs? :-)

Jakob Reschke
Well I suppose there is just too many of them. :-) To put them in a registry you'd have to hold onto them. Having them dangling like now-unused Symbols would be bad.

If you can, I'd say use equality instead of identity.

Marcel Taeumel <[hidden email]> schrieb am Mo., 2. März 2020, 16:38:
Heyho!

The following line made me (somehow) expect to get the same instance of UUID as generated just before via "UUID new":

UUID fromString: '165fea06-1260-bf45-b6e2-43016456a4f8'.

:-D

Testing some object serialization (to/from Json) in combination with an IdentityKeyDictionary, I could not find the key, which is that UUID.

***

General question: Would UUID interning make sense? Could the UUID plugin do it? Do plugins have access to object memory?

Best
Marcel



Reply | Threaded
Open this post in threaded view
|

Re: How to intern UUIDs? :-)

Tobias Pape

> On 02.03.2020, at 18:42, Jakob Reschke <[hidden email]> wrote:
>
> Well I suppose there is just too many of them. :-) To put them in a registry you'd have to hold onto them. Having them dangling like now-unused Symbols would be bad.
>
> If you can, I'd say use equality instead of identity.

yep, they're values.
when 128-bit processors arrive, we can handle them natively :P
-t

>
> Marcel Taeumel <[hidden email]> schrieb am Mo., 2. März 2020, 16:38:
> Heyho!
>
> The following line made me (somehow) expect to get the same instance of UUID as generated just before via "UUID new":
>
> UUID fromString: '165fea06-1260-bf45-b6e2-43016456a4f8'.
>
> :-D
>
> Testing some object serialization (to/from Json) in combination with an IdentityKeyDictionary, I could not find the key, which is that UUID.
>
> ***
>
> General question: Would UUID interning make sense? Could the UUID plugin do it? Do plugins have access to object memory?
>
> Best
> Marcel
>
>



Reply | Threaded
Open this post in threaded view
|

Re: How to intern UUIDs? :-)

Tobias Pape
In reply to this post by marcel.taeumel

> On 02.03.2020, at 16:38, Marcel Taeumel <[hidden email]> wrote:
>
>
> Testing some object serialization (to/from Json) in combination with an IdentityKeyDictionary, I could not find the key, which is that UUID.
>

Don't combine JSON and IdentityKeyDictionary. You're in for some bad time™.
Best regards
        -Tobias