kioba
10/14/2020, 5:17 PMDelimitedScope
to implement option {}
continuation and I realised that DelimContScope
can not manage null
as a shift
return value.
the implementation already using nullable to show that the block is done. I replaced the nullable type with a quick GADT to represent empty state and allow nullable value:
private val nextShift = atomic<Shift<(suspend () -> R)>>(Empty)
is there any better way to avoid constant boxing for the return values of shifts?Jannis
10/14/2020, 5:30 PMraulraja
10/14/2020, 6:56 PMkioba
10/14/2020, 10:18 PMJannis
10/14/2020, 10:44 PMkioba
10/15/2020, 12:03 AMsimon.vergauwen
10/15/2020, 7:24 AMOption
to optimise over allocations in hot-spot areas like this. It sadly requires Any?
and thus also casting in some places.
private object MY_NULL
class Generic<T>(val value: T) {
val atomicValue: Any? = value
fun isMyNull(): Boolean =
atomicValue === MY_NULL
}
kioba
10/15/2020, 7:50 AMsimon.vergauwen
10/15/2020, 7:51 AM?
🙂Jannis
10/15/2020, 8:49 AM