You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -370,7 +371,7 @@ This proposal answers "no" to all the questions above:
370
371
4. No, `context(_: CoroutineContext) fun` isn't equivalent to `suspend fun` from the overload resolution perspective.
371
372
372
373
We prefer to answer "no" because overridability is a very strong type of equivalence.
373
-
The current Kotlin version doesn't allow dropping parameters when you override a function.
374
+
For example, the current Kotlin version doesn't allow dropping parameters when you override a function.
374
375
375
376
And just to add a point, if we answered "yes", it'd introduce non-transitive equivalence into overload resolution.
376
377
`suspend fun foo() {}` and `context(_: CoroutineContext) fun foo() {}` would be equivalent.
@@ -450,7 +451,7 @@ fun main() {
450
451
```
451
452
452
453
- Given that \#5 is red, \#6 should be obviously red.
453
-
- Since the context and `suspend` functions are different from the perspective of overload resolution ([see section](#declaration-site-conflicting_overloads-and-overridability)),
454
+
- Since the context and `suspend` functions are different from the perspective of overload resolution ([see the section](#declaration-site-conflicting_overloads-and-overridability)),
454
455
we propose to make \#3 red – `INITIALIZER_TYPE_MISMATCH`.
455
456
456
457
### `kotlin.synchronized` stdlib function
@@ -610,7 +611,7 @@ That's why the alternative design is not possible either.
610
611
611
612
## Dependencies
612
613
613
-
**(1)** This proposal, in general, depends on [KEEP-367 Context parameters](./context-parameters.md).
614
+
**(1)** This proposal, in general, depends on [KEEP-367 Context parameters](./KEEP-0367-context-parameters.md).
614
615
615
616
**(2)** This proposal depends on the fact that contextual parameters _fill in_ neither extension, nor dispatch holes:
616
617
@@ -625,7 +626,7 @@ fun foo() {
625
626
fun String.functionWithExtensionHole() {}
626
627
```
627
628
628
-
If not the decision to not fill in the extension and dispatch hole, this proposal would be a change of behavior:
629
+
If not the decision, this proposal would be a behavioral change:
629
630
630
631
```kotlin
631
632
suspendfun CoroutineContext.bar() {
@@ -638,7 +639,7 @@ fun CoroutineContext.baz() {}
638
639
Thankfully, it's not the case.
639
640
These examples are indicators of context parameters' good design.
640
641
641
-
## Mock example. `ScopedValues`-like API for `CoroutineContext`
642
+
## Illustrative example. `ScopedValues`-like API for `CoroutineContext`
642
643
643
644
Imagine we want to provide [`ScopedValues`-like API](https://openjdk.org/jeps/506) for `CoroutineContext` so that storing data in `CoroutineContext` is as easy as declaring global variables:
0 commit comments