aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/constant.ml
diff options
context:
space:
mode:
authorGravatar filliatr <filliatr@85f007b7-540e-0410-9357-904b9bb8a0f7>1999-12-09 15:10:08 +0000
committerGravatar filliatr <filliatr@85f007b7-540e-0410-9357-904b9bb8a0f7>1999-12-09 15:10:08 +0000
commita4436a6a355ecb3fffb52d1ca3f2d983a5bcfefd (patch)
tree0252d3bb7d7f9c55dad753f39e83de5efba41de4 /kernel/constant.ml
parentf09ca438e24bc4016b4e778dd8fd4de4641b7636 (diff)
- constantes avec recettes
- discharge en deux temps, avec état remis comme au début de la section (mais c'est toujours buggé) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@224 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel/constant.ml')
-rw-r--r--kernel/constant.ml19
1 files changed, 15 insertions, 4 deletions
diff --git a/kernel/constant.ml b/kernel/constant.ml
index c93d486fa..dda7274af 100644
--- a/kernel/constant.ml
+++ b/kernel/constant.ml
@@ -7,13 +7,15 @@ open Generic
open Term
open Sign
-type constant_entry = {
- const_entry_body : constr;
- const_entry_type : constr option }
+type lazy_constant_value =
+ | Cooked of constr
+ | Recipe of (unit -> constr)
+
+type constant_value = lazy_constant_value ref
type constant_body = {
const_kind : path_kind;
- const_body : constr option;
+ const_body : constant_value option;
const_type : typed_type;
const_hyps : typed_type signature;
const_constraints : constraints;
@@ -23,3 +25,12 @@ let is_defined cb =
match cb.const_body with Some _ -> true | _ -> false
let is_opaque cb = cb.const_opaque
+
+let cook_constant = function
+ | { contents = Cooked c } -> c
+ | { contents = Recipe f } as v -> let c = f () in v := Cooked c; c
+
+type constant_entry = {
+ const_entry_body : lazy_constant_value;
+ const_entry_type : constr option }
+