Vcs.TraitThe traits that Vcs depends on to implement its functionality.
Vcs is parametrized by a list of specific interfaces and classes that constitute the low level operations needed by Vcs. We call them traits.
The intended usage for a library that requires Vcs functionality is to specify via the type of the vcs value, the exact list of traits required. Doing this in this way, allows for flexibility, as any backend supplying that list of traits or more will be compatible as a backend to be supplied to your code.
For example, consider a function that needs to list all the files under version control, and show their contents at some revision. Such functionality will require:
val my_vcs_function
: vcs : < Vcs.Trait.ls_files ; Vcs.Trait.show ; .. > Vcs.t
-> ..
-> ..class type add = Volgo__.Trait_add.tmodule Add : sig ... endclass type branch = Volgo__.Trait_branch.tmodule Branch : sig ... endclass type commit = Volgo__.Trait_commit.tmodule Commit : sig ... endclass type config = Volgo__.Trait_config.tmodule Config : sig ... endclass type current_branch = Volgo__.Trait_current_branch.tmodule Current_branch : sig ... endclass type current_revision = Volgo__.Trait_current_revision.tmodule Current_revision : sig ... endclass type file_system = Volgo__.Trait_file_system.tmodule File_system : sig ... endclass type git = Volgo__.Trait_git.tmodule Git : sig ... endclass type hg = Volgo__.Trait_hg.tmodule Hg : sig ... endclass type init = Volgo__.Trait_init.tmodule Init : sig ... endclass type log = Volgo__.Trait_log.tmodule Log : sig ... endclass type ls_files = Volgo__.Trait_ls_files.tmodule Ls_files : sig ... endclass type name_status = Volgo__.Trait_name_status.tmodule Name_status : sig ... endclass type num_status = Volgo__.Trait_num_status.tmodule Num_status : sig ... endclass type refs = Volgo__.Trait_refs.tmodule Refs : sig ... endclass type show = Volgo__.Trait_show.tmodule Show : sig ... endclass type t = object ... endThe union of all traits defined in Vcs.
class unimplemented : tThis is a special class constructor that creates an object that satisfies the interface defined by the class type t, but where each of the actual method implementation is a function that returns an error indicating that the method is unimplemented.