-
Notifications
You must be signed in to change notification settings - Fork 25
Design: Refactoring and functorization
Currently, the module design of OMake isn't really attractive. Components are not isolated but share a lot of type definitions and helper functions. This is a burden for long-time maintenance, e.g. we couldn't easily replace the evaluater by a bytecode compiler.
The idea is to isolate the following components, so that they are either standalone modules without prerequisites, or are defined as functors that take the prerequisite components as functor arguments:
- Fundamentals
- data types, etc.
- File system access
- Omake_node, plus a module that abstracts any file system access
- Evaluator
- Omake_value_type, Omake_ir
- lexer, parser, compiler
- no built-ins
- Executor
- runs external commands
- Shell
- defines commands that can be run either internally or externally
- abstracts over pipelines, redirections, etc.
- Builder
- Omake_rule, Omake_target, Omake_build
- dependency hierarchy (rules, targets, etc.)
- file system cache (e.g. which files have already been built)
- runs over the deps and emits commands to execute
The pivotal module has not been mentioned yet:
- Environment
- contains various data for the above-mentioned components
Every component (except the fundamentals) has the environment as prerequisite.
Go away from libmojave. Reimplement with stdlib.
Roughly, the file operations from the Unix module where paths are represented as Omake_node.Node.t.
module type FS = sig
val open_file : Omake_node.Node.t -> ... -> channel
...
end
Environmental prerequisite:
module type ENV_FS = sig
(* Concept of current working directory, and translation string <-> node *)
val venv_chdir : t -> Lm_location.t -> string -> t
val venv_chdir_dir : t -> Lm_location.t -> Omake_node.Dir.t -> t
val venv_chdir_tmp : t -> Omake_node.Dir.t -> t
val venv_dirname : t -> Omake_node.Dir.t -> string
val venv_nodename : t -> Omake_node.Node.t -> string
val venv_dir : t -> Omake_node.Dir.t
end
Initially, we provide an implementation for the local file system (or maybe two, one for Unix, one for Windows):
module Local_FS : functor (E:ENV_FS) -> FS