catala icon indicating copy to clipboard operation
catala copied to clipboard

Module support (tracking issue)

Open AltGr opened this issue 2 years ago • 2 comments
trafficstars

Synthetic overview of where module support is currently at

  • Module interface: the catala-metadata sections of a normal Catala file

  • Module name based upon filename at the moment

    • [x] > Module directives
  • Compiling modules

    • [x] introduce a dynlink registration of compiled catala modules into the OCaml runtime for use by the interpreter
    • [x] add a module hash based on interface + Catala version
    • [x] facility to compile module to cmxs directly
  • Using module interfaces (in the compiler)

    • [x] declare use using the CLI
    • [x] or a Using directive
    • [x] register toplevel values
    • [x] register toplevel scopes
    • [x] register type defs
  • Using module implementations (in the interpreter)

    • [x] load the cmxs of the module through dynlink
    • [x] Validate the module hash to ensure consistency of the interface & backend
    • [x] Call the external functions with back-and-forth translation between exprs and runtime values
    • [x] (the above needs more tests. Come on, no segfault yet ??!)
  • Using module implementations (OCaml backend)

    • [x] Manually compiled modules can be linked together using ocamlopt
    • [x] Some facility to handle the compile command ?
  • Using module implementations (other backends)

    • [ ] For js: see how to port the OCaml linking command to jsoo
    • [ ] TODO (later)
  • Native modules (aka externals)

    • [x] it's possible to manually provide the .ml file for a module
    • [ ] facilities to extract the expected mli interface from a catala file
    • [x] facilities to correctly compile the external modules
  • Replacing the monomorphic operators

    • [ ] define an (auto opened) stdlib module
    • [ ] move the operators from the backend to there and adjust the compiler (TODO)
  • Extend all of the above to the other runtimes, providing a suitable stdlib

    • [x] jsoo
    • [x] Python
    • [ ] Others ??

AltGr avatar Jun 21 '23 14:06 AltGr