effekt-lang / effekt-lang/effekt

Mistranslation of recursively forwarded effects in JS backend

Open
#1,358 4 comments 0 reactions 0 assignees View on GitHub
area:js bug
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.