thmd commented on issue #2941:
URL: https://github.com/apache/fory/issues/2941#issuecomment-3654262087

   There are valid cases for both wanting to DeepCopy an Object with transient 
fields and without. A DeepCopy with transient field is obviously most complete 
state copy. But the truth is often (to my knowledge) transient is used to mark 
we don't care about like here Hibernate framework harness which is often not 
useful in a DeepCopy use case.
   
   DeepCopy objets are often used longterm e.g. in a cache which often makes 
transient references to ORM, Thread etc. invalid. Also most often DeepCopy is 
basically done using a serialize+deserialize pair which is what I was using 
before finding Fory.copy and such DeepCopy doesn't copy transient.
   
   Now there are other cases people do want transient fields where they need a 
library with Copy (which is rare) or do something manually. So I think it's 
worth having a Copy without transient option as it allow someone to safely 
migrate from a serialize+deserialize to Fory.copy for the added performance 
(both cpu + memory overhead) gains.
   
   I actually find returning original ref much more risky than skipping 
transient as DeepCopy is meant to give you an independent copy which original 
ref copy breaks and does so very silently.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to