option ML_system_unsafe;
authorwenzelm
Mon, 04 Apr 2016 20:07:08 +0200
changeset 62851 07eea2843b82
parent 62850 1f1a2c33ccf4
child 62852 dd5f3a6fee73
option ML_system_unsafe;
NEWS
etc/options
src/Pure/ML/ml_final.ML
src/Pure/ML/ml_name_space.ML
--- a/NEWS	Mon Apr 04 19:48:54 2016 +0200
+++ b/NEWS	Mon Apr 04 20:07:08 2016 +0200
@@ -230,6 +230,10 @@
 
 *** ML ***
 
+* Low-level ML system structures (like PolyML and RunCall) are no longer
+exposed to Isabelle/ML user-space. The system option ML_system_unsafe
+allows to override this for special test situations.
+
 * Antiquotation @{make_string} is available during Pure bootstrap --
 with approximative output quality.
 
--- a/etc/options	Mon Apr 04 19:48:54 2016 +0200
+++ b/etc/options	Mon Apr 04 20:07:08 2016 +0200
@@ -126,6 +126,9 @@
 public option ML_system_64 : bool = false
   -- "ML system for 64bit platform is used if possible (change requires restart)"
 
+option ML_system_unsafe : bool = false
+  -- "provide access to low-level ML system structures"
+
 
 section "Editor Reactivity"
 
--- a/src/Pure/ML/ml_final.ML	Mon Apr 04 19:48:54 2016 +0200
+++ b/src/Pure/ML/ml_final.ML	Mon Apr 04 20:07:08 2016 +0200
@@ -4,9 +4,11 @@
 Final setup of ML environment.
 *)
 
-(*no access to system internals!*)
-structure PolyML = struct structure IntInf = PolyML.IntInf end;
-val _ = List.app ML_Name_Space.forget_structure ML_Name_Space.critical_structures;
+if Options.default_bool "ML_system_unsafe" then ()
+else
+  (List.app ML_Name_Space.forget_structure
+    ["CInterface", "Foreign", "RunCall", "RuntimeCalls", "Signal"];
+   ML \<open>structure PolyML = struct structure IntInf = PolyML.IntInf end\<close>);
 
 structure Output: OUTPUT = Output;  (*seal system channels!*)
 
--- a/src/Pure/ML/ml_name_space.ML	Mon Apr 04 19:48:54 2016 +0200
+++ b/src/Pure/ML/ml_name_space.ML	Mon Apr 04 20:07:08 2016 +0200
@@ -66,8 +66,10 @@
   val sml_type = #allType global ();
   val sml_fixity = #allFix global ();
   val sml_structure =
-    List.filter (fn (a, _) => a <> "PolyML" andalso a <> "ML_System" andalso
-      not (List.exists (fn b => a = b) critical_structures)) (#allStruct global ());
+    List.filter (fn (a, _) =>
+      not (List.exists (fn b => a = b)
+        ["ML_System", "PolyML", "CInterface", "Foreign", "RunCall", "RuntimeCalls", "Signal"]))
+      (#allStruct global ());
   val sml_signature =
     List.filter (fn (a, _) => a <> "ML_SYSTEM" andalso a <> "ML_NAME_SPACE") (#allSig global ());
   val sml_functor = #allFunct global ();