karelpeeters
04/18/2019, 6:27 PMoperator fun invoke
on the companion but that's even uglier)Joe
04/18/2019, 6:28 PMRuckus
04/18/2019, 6:30 PMTableColumn<String, Int>("fred")
streetsofboston
04/18/2019, 7:17 PMdata class TableColumn<T,U>(val rawColumn: T, val transformer: (U) ->T ) {
constructor(rawColumn: T) : this(rawColumn, { it as T })
}
typealias TableColumnSame<T> = TableColumn<T, T>
fun main() {
val tc = TableColumnSame(5)
}
Still quite unsafe, though, if you don’t use the typalias on the call site 🙂