effekt-lang / effekt-lang/effekt
Referencing `this` in a capture set
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
Imagine I want to perform an operation in 2 steps. I can easily do that by returning a boxed function:
```effekt
interface Foo {
def foo(): Unit => Unit at {}
}
```
but what if I want the second part to also be able to perform further effects that the handler has access to?
What I want is something like:
```effekt
interface Foo {
def foo(): Unit => Unit at {this}
}
```
but that doesn't seem to work.
I'm thinking this must be possible, right? [Scala has it](https://docs.scala-lang.org/scala3/reference/experimental/cc.html#a-larger-example).
I guess I can use CPS
```effekt
interface Foo {
def foo { block: { Unit => Unit } => Unit }: Unit
}
```
However, the CPS version is not as useful, since the second step cannot escape the block, so I can't store it in a list on the outside, for instance.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.