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
While writing up my presentation for the Kotlin SDK, it got me thinking about some design choices we made so.
This is around the naming of our collections.
Right now we have
Realm / MutableRealm (which fits the general split promoted by Kotlin and make it more typesafe)
But for collections we have
RealmList<T> (Which mirrors the Java API, but doesn't really match the normal pattern in Kotlin)
Would it instead make sense to make the split between
RealmList / MutableRealmList
RealmSet / MutableRealmSet
RealmMap / MutableRealmMap
With our current API, it doesn't really make sense with such a split as model classes don't support immutable lists, but with Projections coming in a not-too-distant-future, I could see the distinction being valuable there, e.g.
// Entity model class
class Person: RealmObject {
@PrimaryKey
var name: String
val children: MutableRealmList<Person> = mutableRealmListOf()
}
// Read-only projection, with the read-only semantics expressed in the typesystem.
@Projection(Person::class)
class PersonView {
val name: String
val children: RealmList<Person>
}
Anyway, just a thought, and not something that is critical in the short term. But what do you think?
The text was updated successfully, but these errors were encountered:
While writing up my presentation for the Kotlin SDK, it got me thinking about some design choices we made so.
This is around the naming of our collections.
Right now we have
Realm
/MutableRealm
(which fits the general split promoted by Kotlin and make it more typesafe)But for collections we have
RealmList<T>
(Which mirrors the Java API, but doesn't really match the normal pattern in Kotlin)Would it instead make sense to make the split between
RealmList
/MutableRealmList
RealmSet
/MutableRealmSet
RealmMap
/MutableRealmMap
With our current API, it doesn't really make sense with such a split as model classes don't support immutable lists, but with Projections coming in a not-too-distant-future, I could see the distinction being valuable there, e.g.
Anyway, just a thought, and not something that is critical in the short term. But what do you think?
The text was updated successfully, but these errors were encountered: