Skip to content

Instantly share code, notes, and snippets.

@charlesetc
Created April 25, 2018 04:56
Show Gist options
  • Save charlesetc/b24cdb8a7f6c08d1dc471fa6920f745c to your computer and use it in GitHub Desktop.
Save charlesetc/b24cdb8a7f6c08d1dc471fa6920f745c to your computer and use it in GitHub Desktop.
OCaml compiler variation
(* 4.06 *)
let initial_env () =
Ident.reinit();
let initial =
if Config.safe_string then Env.initial_safe_string
else if !Clflags.unsafe_string then Env.initial_unsafe_string
else Env.initial_safe_string
in
let env =
if !Clflags.nopervasives then initial else
open_implicit_module "Pervasives" initial
in
List.fold_left (fun env m ->
open_implicit_module m env
) env (!implicit_modules @ List.rev !Clflags.open_modules)
(* trunk *)
let initial_env () =
Ident.reinit();
let initially_opened_module =
if !Clflags.nopervasives then
None
else
Some "Stdlib"
in
Typemod.initial_env
~loc:(Location.in_file "command line")
~safe_string:(Config.safe_string || not !Clflags.unsafe_string)
~initially_opened_module
~open_implicit_modules:(!implicit_modules @ List.rev !Clflags.open_modules)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment