effekt icon indicating copy to clipboard operation
effekt copied to clipboard

WIP: Make more types extern instead of builtin

Open marzipankaiser opened this issue 1 year ago • 7 comments

This PR is a draft to move types from being builtins (in symbols.builtins) to extern type declarations in the prelude. To do so, it annotates the operations using those types (If, While for Boolean, Assign for Unit (and Ref)) with Ids referring to them, which are then resolved by Namer and used by Typer.

For phases after core, it will also add an ExternContext (sim. to DeclarationContext in #204).

Implications:

  • Using e.g. If in a backend that does not support Booleans yet will lead to an error in Namer
  • All of the builtin types are identified by name (only) and can potentially be overwritten, possibly leading to strange behaviour
    • This might be solved by having a #30.
    • On the plus side, this also allows individual backends to decide that, e.g., Boolean is a data type (not builtin)

marzipankaiser avatar Dec 19 '22 18:12 marzipankaiser