effekt-lang / effekt

A research language with effect handlers and lightweight effect polymorphism

Home Page:https://effekt-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Share standard library code between backends

phischu opened this issue · comments

In folder ./libraries we have multiple standard libraries. One for each backend. These overlap partially. The goal is to share code between them.

We identify 5 categories of definitions:

  1. Backend-specific extern definitions (e.g. DOM manipulation)
  2. General extern definitions (e.g. Int, infixAdd)
  3. Definitions that are extern for performance reasons or for quicker implementation (e.g. Regex)
  4. Definitions using only general extern definitions (e.g. repeat)
  5. Definitions using no extern definitions (e.g. List)

Category (1) can never be shared. Category (5) can always be shared. Category (4) can be shared as long as the used extern definitions have roughly the same semantics. Therefore we would like some kind of informal specification for those in category (2). Category (3) I would like to forbid.

We should come up with a concrete organizational scheme that separates these categories. We should also come up with concrete rules for extending the standard libraries and write these down.

That's a very important issue. However, we cannot forget that some backends might implement stdlib functions differently (either for performance reasons, or for lack of missing features).

For instance in JS we would often use while and var -- where in other backends we would write a local tail-recursive function. Ideally, in this concrete example the two things mean the same, though.