You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#11864 made the think about how our enum serialization works and I think the way this is handled isn't ideal. Here's some code demonstrating what I mean:
We can already tell from the serialization string that there are two w entries, even though there's only one enum instance involved. The checkIdentity function confirms the loss of identity.
The existence of a cache mechanism suggests to me that the identity is supposed to be preserved because otherwise we might as well remove it for enums entirely. They can't be recursive by themselves because they are immutable, which is why I'm establishing the recursion through an object.
I would prefer to fix the referencing, but that seems difficult because we don't have the enum instance before we read its arguments.
The text was updated successfully, but these errors were encountered:
After looking at this a bit I've concluded that this is not worth looking into. The only way to fix it would be to defer the deserialization of nested structures, so that we can create identities first and then reference them when populating structures. This would be too much of a departure from the current serialization implementation, and perhaps more suited to a custom one.
#11864 made the think about how our enum serialization works and I think the way this is handled isn't ideal. Here's some code demonstrating what I mean:
We can already tell from the serialization string that there are two
w
entries, even though there's only one enum instance involved. ThecheckIdentity
function confirms the loss of identity.The existence of a cache mechanism suggests to me that the identity is supposed to be preserved because otherwise we might as well remove it for enums entirely. They can't be recursive by themselves because they are immutable, which is why I'm establishing the recursion through an object.
I would prefer to fix the referencing, but that seems difficult because we don't have the enum instance before we read its arguments.
The text was updated successfully, but these errors were encountered: