Skip to content
Snippets Groups Projects
Commit 492d5a9a authored by Ralf Jung's avatar Ralf Jung
Browse files

remove the super hacky non-CPS version of string_to_ident

parent ef29659d
No related branches found
No related tags found
No related merge requests found
...@@ -80,15 +80,5 @@ by ident [id] into the name given by string [s]. *) ...@@ -80,15 +80,5 @@ by ident [id] into the name given by string [s]. *)
Ltac rename_by_string id s := Ltac rename_by_string id s :=
StringToIdent.string_to_ident_cps s ltac:(fun x => rename id into x). StringToIdent.string_to_ident_cps s ltac:(fun x => rename id into x).
(** We can also use this to write Ltac that *returns* the desired ident. (* We also directly expose the CPS primitive. *)
However, this function will produce wrong results under [Set Mangle Names], so Ltac string_to_ident_cps := StringToIdent.string_to_ident_cps.
use with caution. *)
Ltac string_to_ident s :=
let s := (eval cbv in s) in
let x := constr:(ltac:(clear; (* needed since s might already be in scope
where this is called *)
StringToIdent.string_to_ident_cps s ltac:(fun x => intros x);
exact tt) : unit -> unit) in
match x with
| (fun (name:_) => _) => name
end.
...@@ -32,7 +32,7 @@ Lemma test_string_to_ident_not_fresh (n:nat) : ∀ (n:nat), nat. ...@@ -32,7 +32,7 @@ Lemma test_string_to_ident_not_fresh (n:nat) : ∀ (n:nat), nat.
Proof. Proof.
(* we want to check that this [string_to_ident "n"] call succeeds even with (* we want to check that this [string_to_ident "n"] call succeeds even with
[n] in the context *) [n] in the context *)
let x := string_to_ident "n" in string_to_ident_cps "n" ltac:(fun x =>
let x := fresh x in let x := fresh x in
intros x. intros x).
Abort. Abort.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment