effekt-lang / effekt-lang/effekt

RFC: Labelling implicit effects into explicit capabilities

Open
#948 1 comment 2 reactions 0 assignees View on GitHub
quality-of-life requires-design
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

> [!NOTE]
> This is a request for comments in very early stages, feel free to comment/nitpick below.

Allow explicitly naming capabilities in effect sets in order to recover `summon`-style functionality, for example:
```scala
def foo(): Unit / {out: emit[Int], in: read[Byte], log, Exception[WrongFormat]} = {
val n: Int = in.read().toInt
do log(s"Saw: ${n}, emitting both it, and its square")
do emit(n)
out.emit(n * n)
}
```

then gets translated to
```scala
def foo() {out: emit[Int]} {in: read[Byte]} {$log: log} {$exc: Exception[WrongFormat]}: Unit = {
val n: Int = in.read().toInt {$exc}
$log.log(s"Saw: ${n}, emitting both it, and its square")
out.emit(n)
out.emit(n * n)
}
```

I think it's somewhat straightforward change in Parser, Namer, and ExplicitCapabilities, no changes at all from Core onwards, but I have no clue how big of a change this would be for Typer (I hope it's easy, but I can't really tell for sure).

As a bonus, this allows the LSP to come up with names, show them as inlay hints, and then we can even mention them in error messages.

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.