. But I have a feeling @simon.vergauwen could have some some near future good news regarding this topic 🙂
s
simon.vergauwen
06/17/2021, 10:02 AM
Currently, this is indeed not possible since
interface
cannot contain any
inline
functions (this is because there no code to inline, since it's dispatched to a runtime implementation).
simon.vergauwen
06/17/2021, 10:09 AM
It's possible however to add, extension functions to the interface that allow inlining.
i.e.
Copy code
inline fun <S, A> Lens<S, A>.modifySuspend(source: S, f: (A) -> A): S {
val focus = get(source)
f(focus)
return set(source, focus)
}
This could be solved by moving to
class
, and revering the current hierarchy to not use inheritance for auto-conversion between optics.
simon.vergauwen
06/17/2021, 10:09 AM
If interested, we could move this to a ticket to discuss further there.
a
Alexander Levin
06/24/2021, 7:45 PM
@simon.vergauwen as it was single use case only the problem was just solved without optics. However for the future it would be nice to have some solution that works with suspend (and I guess with other "code coloring" as well but idk)
So yeah, adding this discussion to some ticket would be great :)