@@ -191,19 +191,34 @@ let bigN_list_of_constructors =
191
191
in
192
192
build 0
193
193
194
+ let cache_bignums o =
195
+ Notation. declare_scope o.Notation. pt_scope;
196
+ Notation. enable_prim_token_interpretation o
197
+
198
+ let bignums_obj =
199
+ Libobject. declare_object @@
200
+ Libobject. superglobal_object_nodischarge " bignums_obj"
201
+ ~cache: cache_bignums
202
+ ~subst: None
203
+
194
204
let declare_numeral_interpreter uid sc dir interp (patl ,uninterp ,b ) =
195
- let open Notation in
196
- register_bignumeral_interpretation uid (interp,uninterp);
197
- enable_prim_token_interpretation { pt_local = false ;
198
- pt_scope = sc;
199
- pt_interp_info = Uid uid;
200
- pt_required = dir;
201
- pt_refs = patl;
202
- pt_in_match = b }
205
+ (* unsynchronized state *)
206
+ Notation. register_bignumeral_interpretation uid (interp,uninterp);
207
+ let interp () = Lib. add_leaf (bignums_obj {
208
+ (* we wrap in out own object (to get superglobal instead of export),
209
+ so we pass local to the Notation layer *)
210
+ pt_local = true ;
211
+ pt_scope = sc;
212
+ pt_interp_info = Uid uid;
213
+ pt_required = dir;
214
+ pt_refs = patl;
215
+ pt_in_match = b;
216
+ })
217
+ in
218
+ Mltop. declare_cache_obj_full (CacheObj { synterp = (fun () -> () ); interp; }) " coq-bignums.plugin"
203
219
204
220
(* Actually declares the interpreter for bigN *)
205
221
let () =
206
- Notation. declare_scope bigN_scope;
207
222
declare_numeral_interpreter " bignums.bigN" bigN_scope
208
223
(bigN_path, bigN_module)
209
224
interp_bigN
@@ -241,7 +256,6 @@ let uninterp_bigZ (AnyGlobConstr rc) =
241
256
242
257
(* Actually declares the interpreter for bigZ *)
243
258
let () =
244
- Notation. declare_scope bigZ_scope;
245
259
declare_numeral_interpreter " bignums.bigZ" bigZ_scope
246
260
(bigZ_path, bigZ_module)
247
261
interp_bigZ
@@ -263,7 +277,6 @@ let uninterp_bigQ (AnyGlobConstr rc) =
263
277
264
278
(* Actually declares the interpreter for bigQ *)
265
279
let () =
266
- Notation. declare_scope bigQ_scope;
267
280
declare_numeral_interpreter " bignums.bigQ" bigQ_scope
268
281
(bigQ_path, bigQ_module)
269
282
interp_bigQ
0 commit comments