I have a generic class: Slot<T>. I’m trying ...
# announcements
t
I have a generic class: Slot<T>. I’m trying to add extension
var
to it when/where T is Comparable. The syntax is eluding me. I tried: var <T : Comparable<T>>Slot.concisely:T get() = this.value set(newValue) { if (this.value != newValue) { this.value = newValue } } But I’m getting a “Type property of parameter must be used in property type”. What am I missing? I’m guessing a bit at the syntax based this snippet seen in the documentation: fun <T : Comparable<T>> sort(list: List<T>) { ... }
rubber duck 1