kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Allow (de-)serializing value classes if their backing property is serializable

Open Martmists-GH opened this issue 1 year ago • 0 comments

What is your use-case and why do you need this feature?

For example, in Compose code, one might want to save the user's custom theme by serializing Colors. These are defined as value class Color(value: ULong) which should be trivial to (de-)serialize, as value classes guarantee a single-argument constructor and a single field to handle.

Describe the solution you'd like

Value classes are serialized as if serialize(myXTypeValue.value) was called, and deserialized like XType(deserialize(encValue))

Martmists-GH avatar Jun 29 '24 10:06 Martmists-GH

But this could apply to any number of situations, like someone moving a queen as a knight or something. I think a checkbox should be used for illegal imports. And it will cause havoc with analysis.

Siderite avatar Jun 26 '24 20:06 Siderite

Maybe Dup https://github.com/lichess-org/lila/issues/7994

SergioGlorias avatar Nov 02 '24 20:11 SergioGlorias

But this could apply to any number of situations, like someone moving a queen as a knight or something.

I think these moves were never registered in a DGT, but they were registered in check.

SergioGlorias avatar Mar 11 '25 15:03 SergioGlorias