papers : https://okmij.org/ftp/meta-programming/StagingNG.pdf
https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems.pdf
#if and #defineenable metaprogramming for conditional compilation purposes, like selecting a (whole) data type definition for a given version of a standard (protocol).#include use is twofold: (1) piecing together files containing bits of smart contracts, like data type definitions, (2) embedding Michelson files (.tz) in verbatim strings. These are linked to separate compilation (see #if above). Would adding anincludestatement in CameLIGO replace the use of #include? It seems that (2) cannot be solved using using include (see for example this answer by Tom). Also, for (1), we need a way of using a path that traverses directories, for example: #include "../../bar/foo.ligo”. How would we replace it using include (in particular the ..), given that we aim at supporting Linux, Darwin and Windows?import * as M from "my/path" but not in CameLIGO where the mapping of module names to/from paths on the file system rely on interactions with the build and package systems. Those file paths are an obstacle to running compilation of JsLIGO files in the browser. #import is used in CameLIGO. It features the same drawbacks as import in JsLIGO (see previous point). Note that #import can also be used in JsLIGO, concurrently to import, which raises some questions.open & include global scoping statement à la OCaml (or even local: let open M in e), we must consider its impact on aggregation. (NOTE: Gabriel recently closed https://gitlab.com/ligolang/ligo/-/merge_requests/2149) We will have to consider the impact of open & include on get-scope , for example if we open two modules then we need to deal with shadowing:module A = struct let x = 1 end
module B = struct let x = 42 end
open A
open B
let () = assert (x = 42)
import to CameLIGO and make the build system process the AST to extract the dependencies ? (Should be easy.)get-scopeimport * as M from “my/path”
On the browser, relative paths could resolve URI relative to the current HTTP document. So import * as M from "./bigarray.mligo" would resolve to http://<domain>/bigarray.mligo if the IDE is being served at http://<domain>import * as M from "./token.jsligo"import * as FA2 from “@ligo/fa” or import * as BA from "@ligo/bigarray/lib.mligo"find function which we use in the preprocessor,
ModRes)