Hello everyone! I was tinkering with the Kotlin Sy...
# compiler
f
Hello everyone! I was tinkering with the Kotlin Symbol Processing code for K2 a couple of days ago, and it led me into the Kotlin's Analysis API code. What got my attention in particular was the usage of context receivers in the API, e.g. in KtKeywordsRenderer.kt at v2.0.0-RC1 (and many more places). As context receivers were in "prototype" status for some time now, it got me excited that they are finally going to be promoted into something more stable. Well, if they are being used like that in a public (albeit still very technical) API. But as the time of writing, I couldn't find the code anymore! As I discovered, context receivers usage was removed from the API yesterday! The master branch doesn't have it anymore, and the internal doc for AA was updated replacing them with extension receivers. So, I'm curious, what was the history behind these decisions? Context receivers were allowed to be used for pre-stable compiler code (even in RC), but got replaced in preparation for stable release, is that correct? Is it okay to still use them in an internal non-API code?
y
My guess is that they didn't want to commit to a stable API for context receivers when the design isn't finalized yet
o
f
Oh well, that explains it.
y
The proposal is about expansion and cleanup. The core idea of contexts is still there, but now maybe with names and only on functions/properties
o
"Expansion and cleanup" would be a misinterpretation. Context receivers are types, context parameters are an entirely different concept as the summary points out:
1. Introduction of named context parameters,
2. Context receivers are dropped,