Kotlin / Kotlin/dataframe

[Future] context receiver support

Open
#325 3 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

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:
```kotlin
context(ColumnsSelectionDsl)
public inline fun KProperty<*>.colsOf(): ColumnSet =
colsOf(typeOf())
```
would enable you to write:
```kotlin
df.select { MyType::myGroup.colsOf() }
```
instead of
```kotlin
df.select { (MyType::myGroup)().colsOf() }
```

And this is only the tip of the iceberg of course!

Contributor guide

Open the contributing guide

Research direction

Start with the Kotlin KEEP issue 259 to verify the proposed context receiver feature and its availability. Then inspect ColumnsSelectionDsl and the colsOf examples described here; the work is complete only when the supported Kotlin syntax enables the shown DSL usage without the current workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.