Skip to content

[Future] context receiver support #325

Open
@Jolanrensen

Description

Context receivers are a proposed Kotlin feature: Kotlin/KEEP#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:

context(ColumnsSelectionDsl)
public inline fun <reified C> KProperty<*>.colsOf(): ColumnSet<Any?> =
    colsOf(typeOf<C>())

would enable you to write:

df.select { MyType::myGroup.colsOf<Int>() }

instead of

df.select { (MyType::myGroup)().colsOf<Int>() }

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

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions