Kotlin / Kotlin/kandy

Problem with `SelfInvocationContext`

Open
#466 0 comments 0 reactions 0 assignees View on GitHub
api invalid
Dominant language
Kotlin
Stars
744
Forks
27
Avg merge
4d 1h
Merged PRs (30d)
1

Description

[SelfInvocationContext](https://github.com/Kotlin/kandy/blob/3de2c8bfb0f196583e9786334557c6513b970723/kandy-api/src/main/kotlin/org/jetbrains/kotlinx/kandy/util/context/SelfInvocationContext.kt) is a special interface that actually works like trait. It has `invoke()` extension function that opens scope with this as a reciever:
```
public operator fun T.invoke(block: T.() -> Unit): T = apply(block)
```

It simplifies DSL creation (see `Axis` or `Legend` API for example), but it complicates work with Kandy in Gradle projects, since user need `invoke` import (and IDEA doesn't even suggest to add this import!).

Contributor guide

Open the contributing guide

Research direction

Start by reading kandy-api/src/main/kotlin/org/jetbrains/kotlinx/kandy/util/context/SelfInvocationContext.kt and compare its use in the Axis and Legend APIs. Reproduce the Gradle usage problem described in the issue, including the missing invoke import and IDEA's lack of an import suggestion. The issue needs a decided direction before a newcomer can tell what change would be complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api, developer-experience
Issue type
Bug
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.