effekt
effekt copied to clipboard
Share standard library code between backends
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:
- Backend-specific extern definitions (e.g. DOM manipulation)
- General extern definitions (e.g.
Int
,infixAdd
) - Definitions that are extern for performance reasons or for quicker implementation (e.g.
Regex
) - Definitions using only general extern definitions (e.g.
repeat
) - 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.
Is this fixed by #449, @phischu?
Yes.