Marshal icon indicating copy to clipboard operation
Marshal copied to clipboard

making contextType optional in UnmarshalingWithContext and UnmarshalUpdatingWithContext protocols

Open gautier-gdx opened this issue 7 years ago • 2 comments

For some databases like Realm managed Object are not systematically persisted and doesn't need a context to be initialised: a Realm object in this case. Having to create a Realm (or other type of coordinator) each time we want to generate those type of object even if we don't need it can lead to real performance issues.

That why I propose in my pull request to make the context an optional in both UnmarshalingWithContext and UnmarshalUpdatingWithContext protocols.

gautier-gdx avatar Nov 23 '16 16:11 gautier-gdx

That is a good point, this is a breaking API change though so we'll have to give it some thought.

Do we change this API? Provide new API? Not sure.

jarsen avatar Nov 28 '16 21:11 jarsen

Is any change really required? It's an associated type, so optional context is just another type. I just tried it out in my app and it appears to be fine.

KingOfBrian avatar Dec 02 '16 17:12 KingOfBrian