https://kotlinlang.org logo
#arrow
Title
# arrow
c

CLOVIS

03/13/2023, 10:36 AM
It's confirmed that multi-platform context receivers won't be available before Kotlin 2.0.
j

Javier

03/13/2023, 10:39 AM
Yeah, it was confirmed some time ago
Finish K2 and then context receivers
c

CLOVIS

03/13/2023, 10:40 AM
There was a discussion last week (can't remember if it was in this channel or another one) where people thought it would be for 1.9, so I just wanted to share the confirmation
j

Javier

03/13/2023, 10:42 AM
Oh, I just didn't read it 😕
I think Context Receivers will not be even on 2.0, but the before after that
c

CLOVIS

03/13/2023, 10:43 AM
Yeah, I think it's likely it'll be 2.1
j

Javier

03/13/2023, 10:43 AM
I bet that too, 2.1 beta and 2.2 stable
c

CLOVIS

03/13/2023, 10:43 AM
it seems the be the big feature everyone is waiting for, they probably don't want to mix it up with 2.0 which is supposed to be a massive refactor
s

simon.vergauwen

03/13/2023, 10:49 AM
Yes, someone on Twitter was claiming last week it was confirmed for 1,9, but I also thought it was confirmed some time ago it wouldn't land before 2.0 and not together with 2.0
Let's hope it's soon, if it's 2.2 then it's probably 12+ months away 😭
c

CLOVIS

03/13/2023, 10:50 AM
Ah, it was on Twitter? I remember I saw your name so I thought it was here.
j

Javier

03/13/2023, 10:50 AM
Simon stops fake news
🙃
p

phldavies

03/13/2023, 10:52 AM
I can’t say I’d be surprised if they waited for 2.1 for beta and 2.2 for stable, although I doubt it being beta will stop many of us…
c

CLOVIS

03/13/2023, 10:53 AM
Ahah it definitely won't
s

simon.vergauwen

03/13/2023, 10:53 AM
Well Kotlin being quite conservative with these labels beta translates to "please use it in production, and let us know if you encounter issues" 😛
p

phldavies

03/13/2023, 10:53 AM
I thought that’s what “experimental” meant 😄
s

simon.vergauwen

03/13/2023, 10:53 AM
I mean how long has
kotlin.time
been
Experimental
and
FlowPreview
? 😄
c

CLOVIS

03/13/2023, 10:54 AM
…I've read the KEEP so many times I have internalized a lot of the new concepts, I'm constantly writing code that I feel should work but doesn't because they're not here yet 😅
j

Javier

03/13/2023, 10:54 AM
I still have the FlowPreview optIn on Gradle
c

CLOVIS

03/13/2023, 10:55 AM
Remember for how long
@OptIn
required an opt-in itself? 🙃
p

phldavies

03/13/2023, 10:55 AM
My work’s going to be cut out on persuading any next role I land to move to Arrow, let alone embrace context receivers. Seems most companies are still focused on kotlin+spring-boot. So I have time yet for them to get the ball rolling again with context receivers.
c

CLOVIS

03/13/2023, 10:56 AM
Ahah. We're Kotlin+Http4k here, I'm trying to convince them coroutines are worth it. Then Arrow. Then Compose Web instead of Angular.
p

phldavies

03/13/2023, 10:57 AM
It would be great if they could at least resolve a few of the front-end issues with context-receivers before dropping progress, but they’re not the biggest team so fully understand the need to pioritise.
c

CLOVIS

03/13/2023, 10:58 AM
CRs?
p

phldavies

03/13/2023, 10:58 AM
context-receives (updated)
c

CLOVIS

03/13/2023, 10:59 AM
All my projects are JVM+JS 😭
p

phldavies

03/13/2023, 11:00 AM
I had too much fun recently with introducing Kotlin to a scala team based on cats-effect - it’s surprising how similar you can get with Arrow’s resources and ktor/coroutines.
s

simon.vergauwen

03/13/2023, 11:01 AM
I hope to contribute into that area after 2.0. Building more examples, content, integration libs, working in some spaces outside of Spring to OSS some of internal solutions.
@phldavies super curious to hear more about that!
j

Javier

03/13/2023, 11:02 AM
@simon.vergauwen is there any sample about spring + raise + context receivers?
I have a project in which I didn't see a lot of value in using ktor as it is gRPC and there is a Gradle plugin for Spring + gRPC
s

simon.vergauwen

03/13/2023, 11:02 AM
We're working one, Spring & Arrow. https://github.com/47deg/gh-alerts-subscriptions-kotlin-spring (Without CR)
j

Javier

03/13/2023, 11:04 AM
AFAIK, it wouldn't be possible to do anything with context receivers on Spring until they support them?
Well, I think their current injection framework should support them as CR are just syntax sugar and if they do DI on Java then they are just passed as constructor parameters
p

phldavies

03/13/2023, 11:06 AM
Interesting - I didn’t notice you’d two versions of the app. I’ll have to take a look later 🙂
If I recall correctly, spring does have some level of kotlin-aware introspection in order to support default parameters and the like - so it may well be that direct support for context receivers is required. However you can likely provide lightweight bridging methods as required to circumvent any restrictions.
s

simon.vergauwen

03/13/2023, 12:13 PM
The app is still in WIP, and the same colleague is also working on a more modern Spring app using the Spring "functional" DSLs. Indeed I think some kind-of bridging could be provided, perhaps just something like:
Copy code
@Controller class MyController(
  depA: DepA,
  depB: DepB
): DepA by depA, depB by DepB {
  // can call context(DepA, DepB)
}
p

phldavies

03/13/2023, 12:24 PM
I'd certainly be interested in seeing a Spring DSL focused example service as stepping back to the annotation-driven world is the one thing I'm not looking forward to.
s

simon.vergauwen

03/13/2023, 1:21 PM
IMO you're still better off with Ktor if you can, but if offers a good middle ground if you're for some reason stuck to Spring. The reasons for being stuck to Spring are typically either, some custom Spring coupled internal frameworks or large teams being "knowledge stuck" to Spring. In both cases moving to annotation-less Spring has the same hurdles as adopting Ktor.
p

phldavies

03/13/2023, 1:26 PM
All depends on the company/team I end up joining. 🤞 I'm not stuck in a spring-only monolith... 😂
j

Javier

03/13/2023, 1:38 PM
@simon.vergauwen problem with ktor I don't see any benefit with gRPC even I created the grpc engine manually. Profiles and so on...
s

simon.vergauwen

03/13/2023, 1:41 PM
Are you using grpc with Spring, or directly the grpc servers from Google? I would just use the latter.
t

thanh

03/13/2023, 6:10 PM
I used context receiver in my previous company and I love it,
combine with Arrow family, that made even working with Spring is a pleasure!
7 Views