Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Immutable objects #1035
For frameworks like RxJava (#865) and others that work better with value type semantics, being able to specify a RealmObject as
The semantics of this would be that marking a RealmObject as
There are corner cases to consider though, eg. comparing a RealmObject with Standalone object, and possible others.
Having used Reactive Programming extensively for an application where thread safety is key, I'm thinking of a variant of this.
This calls for a different pattern: instead of instantiating one RealmObject descendant class and updating the fields when data changes, instantiate immutable RealmObject descendant class each time one is needed.
Optionally (because in my experience it was not necessary), a method can be called on such an object to see if it's still up-to-date.
This pattern could be implemented as an option, since it's not the default Realm behavior.
What do you think?