From c54142e48402d36f0b69239612bf04c1e5bd9ee4 Mon Sep 17 00:00:00 2001 From: herbelin Date: Thu, 8 Nov 2007 22:22:16 +0000 Subject: Prise en compte des notations "alias" dans la globalisation des coercions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Au passage, un peu plus de standardisation des noms de fonctions de globalisation Principe de base : locate_foo : qualid -> foo (échoue avec Not_found) global : reference -> global_reference (échoue avec UserError) global_of_foo : foo -> global_reference (échoue avec UserError) f_with_alias : se comporte comme f mais prenant aussi en compte les notations de la forme "Notation id:=ref" Principale exception : locate, au lieu de locate_global locate_global_with_alias, qui prend en entrée un "qualid located" Restent beaucoup de fonctions qui pourraient utiliser global_with_alias au lieu de global, notamment dans contribs. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10305 85f007b7-540e-0410-9357-904b9bb8a0f7 --- library/libnames.ml | 2 ++ library/libnames.mli | 2 ++ library/nametab.ml | 4 ++-- library/nametab.mli | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'library') diff --git a/library/libnames.ml b/library/libnames.ml index dcdd5ac41..4d25c42f9 100644 --- a/library/libnames.ml +++ b/library/libnames.ml @@ -49,8 +49,10 @@ let constr_of_global = function | ConstructRef sp -> mkConstruct sp | IndRef sp -> mkInd sp +(* let constr_of_reference = constr_of_global let reference_of_constr = global_of_constr +*) module RefOrdered = struct diff --git a/library/libnames.mli b/library/libnames.mli index fe5033d73..6c6d435be 100644 --- a/library/libnames.mli +++ b/library/libnames.mli @@ -34,9 +34,11 @@ val constr_of_global : global_reference -> constr raise [Not_found] if not a global reference *) val global_of_constr : constr -> global_reference +(* (* Obsolete synonyms for constr_of_global and global_of_constr *) val constr_of_reference : global_reference -> constr val reference_of_constr : constr -> global_reference +*) module Refset : Set.S with type elt = global_reference module Refmap : Map.S with type key = global_reference diff --git a/library/nametab.ml b/library/nametab.ml index ffca8bf4a..395b2159f 100644 --- a/library/nametab.ml +++ b/library/nametab.ml @@ -427,7 +427,7 @@ let global r = | TrueGlobal ref -> ref | SyntacticDef _ -> user_err_loc (loc,"global", - str "Unexpected reference to a syntactic definition: " ++ + str "Unexpected reference to a notation: " ++ pr_qualid qid) with Not_found -> error_global_not_found_loc loc qid @@ -497,7 +497,7 @@ let pr_global_env env ref = let s = string_of_qualid (shortest_qualid_of_global env ref) in (str s) -let global_inductive r = +let inductive_of_reference r = match global r with | IndRef ind -> ind | ref -> diff --git a/library/nametab.mli b/library/nametab.mli index 2f6e9e8cb..66de6a708 100755 --- a/library/nametab.mli +++ b/library/nametab.mli @@ -89,9 +89,9 @@ val locate : qualid -> global_reference val global : reference -> global_reference (* The same for inductive types *) -val global_inductive : reference -> inductive +val inductive_of_reference : reference -> inductive -(* This locates also syntactic definitions *) +(* This locates also syntactic definitions; raise [Not_found] if not found *) val extended_locate : qualid -> extended_global_reference (* This locates all names with a given suffix, if qualid is valid as -- cgit v1.2.3