Open Jolanrensen opened 1 year ago
Wire this to the MAIN ticket to let the Kotlin Designers that we are waiting for them to improve our library! (I am serious)
They, unfortunately, won't work on it until after K2 is stabilized.
imagine you want to save "group" in aggregate as a column. For example, you want to calculate aggregation and observe data too
groupBy.aggregate {
this into "group"
sum() into "sum"
}
Now "this" is a complex type AggregatableDsl or something like this, and it won't be recognized as DataFrame. While it can be fixed in multiple ways, i like that with context parameters type will become context(AggregateDsl) DataFrame.(DataFrame) -> Unit
and this
will become a DataFrame without additional work
Context receivers are a proposed Kotlin feature: https://github.com/Kotlin/KEEP/issues/259.
DataFrame could greatly benefit if this feature ever gets added properly since it's built around so many DSLs. Oftentimes we are limited because we cannot write inline extension functions inside interfaces, requiring either to foil the public function space or to rewrite the function to not be inline (which is not always possible).
Example:
would enable you to write:
instead of
And this is only the tip of the iceberg of course!