AdamsLair / duality

a 2D Game Development Framework

Home Page:https://adamslair.github.io/duality

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duality Serializers should support updating an existing instance when loading

ilexp opened this issue · comments

commented

Summary

Right now, Duality serializers always return a new instance of a deserialized / loaded object. This should be extended to allow updating an existing instance.

Analysis

  • Deep instance re-use would be the ideal case, but will need further investigation.
  • Shallow instance re-use for only the provided top-level object could be some first iteration middle ground, but should only be done if significantly easier than the deep case, depending on investigation results.
  • A workaround in the mean time could be to deserialize into a new temp instance and use the cloning system to copy all values over to the existing instance.