Has anyone put any thought into the idea of an ann...
# language-evolution
g
Has anyone put any thought into the idea of an annotation or language construct that would force a data class to use a generic property delegate or property delegate provider to represent all of its fields? I think it would be useful in a number of cases but one big one that jumps out at me is for allowing your serializable data model to cleanly be backed by something like Compose's
MutableState
I don't think the annotation would be particularly hard to implement if it took a class reference to an object class that implemented
getValue
and
setValue
. Getting kotlinx serialization to work with it is potentially different story though (idk 🤷‍♂️)
z
I feel like the whole data class thing needs to be rethought maybe more fundamentally? It is almost demoware, not useful in APIs (because of backward compatibility), or for more advanced data modeling like this.
g
There is a part of me that agrees with this deeply. In a framework for a rules engine I've been designing for the last 9-ish months I've had to completely abandoned them for interfaces and a compiler plugin that handles a lot of the features data classes have. That's way too heavyweight for what I need now though
👍🏻 1
c
What are you trying to do exactly? The description is a bit too vague for me to follow