Q: Kotlin: How to create a generic decorator class using a delagate I was looking for a way to timestamp arbitrary data using a decorator function. However the following is not valid kotlin code
data class Timestamped<T: Any>(val timestamp: Instant, private val decorated: T): T by decorated

The goal is to add a timestamp property to the data while still having its member properties directly accessible ie
val timedString = Timestamped(Instant.now(), "Hello World")
println(timedString.timestamp)
println(timedString.substring(1))

