Commit a807e559 authored by POTTIER Francois's avatar POTTIER Francois

In [KitSubst], implement [visit_'fn] as the identity,

so that substitution succeeds even if there are names
of type ['fn] which the substitution does not rewrite.
parent 7751f604
...@@ -19,10 +19,14 @@ let extend x env = ...@@ -19,10 +19,14 @@ let extend x env =
class ['self] map = object (_ : 'self) class ['self] map = object (_ : 'self)
method private extend = extend method private extend = extend
(* [visit_'fn] is not implemented, as it is up to the user to identify (* [visit_'fn] must be implemented. There could be several kinds of
variable nodes and replace them. This requires overriding a suitable nodes that carry variables of type ['fn], say, [FooVar] and [BarVar],
visitor method. *) and the user may decide to substitute away [FooVar] nodes, but leave
method private visit_'fn _env _x = assert false [BarVar] nodes untouched. Another reason is, in an encoding of ML
disjunction patterns where a bound name can appear several times,
things may be set up so that [visit_'bn] is called at the first
occurrence and [visit_'fn] is called at subsequent occurrences. *)
method private visit_'fn _env x = x
end end
let apply (copy : 'thing -> 'thing) let apply (copy : 'thing -> 'thing)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment