fathom icon indicating copy to clipboard operation
fathom copied to clipboard

Multiple modules

Open brendanzab opened this issue 2 years ago • 1 comments

It would be nice to support breaking up fathom files into multiple modules, especially as files like opentype.fathom get larger.

I’d imagine imports could go at the top of a file:

module opentype;

import fathom.{ u32be, ... etc ... };

import opentype.common.{ unknown_table, optional_table };
import opentype.tables;

And later:

            cvt <- optional_table "cvt " tables.cvt,
            fpgm <- optional_table "fpgm" unknown_table,

Imports should be qualified by default, and form a DAG.

Some questions:

  • what import syntax should we use?
  • how do we find new modules relative to an existing module?
  • how do we dump multiple modules for snapshot testing?
  • how doe we represent modules in the elaborator/evaluator(s)/etc.

brendanzab avatar Feb 02 '23 04:02 brendanzab

What about local imports? local import fathom.u32be; foo would function like let.

Alternatively, we could have an expression version of import, which would be more orthogonal and not requre another binder form in the core syntax let {u32be} = import fathom; foo

Kmeakin avatar Feb 02 '23 14:02 Kmeakin