I can't use `ensure` with multiple `Raise` ?
# arrow
c
I can't use
ensure
with multiple
Raise
?
p
we keep hitting this too - currently we just specify the type-arg to disambiguate 😞
(or name the context parameters and use them directly as receivers)
c
That's a shame, one of the advertised features of context parameters was that this would be allowed and we wouldn't need to create unions anymore
s
I had a discussion with Alejandro about this recently (he is on PTO so not tagging him). This is an inference design choice. This doesn't work so that inference can work through context parameters. That is why in this case it needs to be explicitly disambiguated
ensure<CannotPlayCardsNot...>(..
and
ensure<...TooLow>(..
.
p
It's unfortunately a huge step back compared to receiver-based raise usage which resolves the ambiguity without issue for almost all cases we've encountered
(which does make me consider @Youssef Shoaib [MOD]’s github.com/kyay10/wither and lifting all Raise context-params to receivers...)
c
…the more I use context parameters and the less they deliver on what they promised
I'm a bit worried that the Kotlin team seems to moving to completely different topics even though context parameters are clearly not complete
a
I'm a bit worried that the Kotlin team seems to moving to completely different topics
Just to be clear on this: we're still very much looking at how context parameters behave in practice; even more so now that they are becoming stable. In particular, how to improve inference with lambdas and contexts was being worked on by members of the team -- but the topic is hard and it takes time to deliver some stuff (and the summer break is still ongoing)
c
Perfect 🙏 As long as it's still in progress, it doesn't matter if it takes time