effekt-lang / effekt-lang/effekt

Convention for error reporting and aborting

Open
#502 1 comment 1 reaction 0 assignees View on GitHub
area:compiler documentation quality-of-life
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

It would be nice to have some agreed upon convention on when to use which kind of error reporting:
https://github.com/effekt-lang/effekt/blob/430369f402d78abdc70486ad8d38d54a8cb24060/effekt/shared/src/main/scala/effekt/util/Messages.scala#L115-L134
When should something `abort`? When should something `panic`? When to just `report` an error?

Related to this, what is the contract of calling a `run` function of phase? Should the caller check whether the previous phase reported an error by check if it returned `None` and then `abort`/`panic`, or rather should each phase (callee) handle their own errors appropriately and in turn do not return `Option[A]` but just `A`?

```scala
class SomePhase extends Phase[A, B] {
def run(...)(using ctx: Context): Option[B] = {
// ...
ctx.report(...)
None
}
}

// or rather

class SomePhase1 extends Phase[A, B] {
def run(...)(using ctx: Context): B = {
// ...
ctx.abort(...)
}
}

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.