effekt-lang / effekt-lang/effekt
Mistranslation of recursively forwarded effects in JS backend
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
When running the following program in the JavaScript backend, it runs forever producing `<` on the console, until it stack-overflows:
```
effect stacktrace(): Unit
def withStacktrace{ body: => Unit / stacktrace }: Unit / { stacktrace } = {
def st() = do stacktrace()
try body()
with stacktrace { () => println("<"); st(); resume(()) }
}
def allowStacktrace{ body: => Unit / stacktrace }: Unit = {
try body()
with stacktrace { () => resume(()) }
}
def foo(n: Int): Unit / stacktrace = withStacktrace {
if (n > 0) {
foo( n - 1 )
} else { do stacktrace() }
}
def main() = allowStacktrace {
foo(2)
}
```
(no playground link, since the playground just hangs...)
This is not the case in LLVM, Chez (also CPS), and also should not be the case.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.