From f6e979127b60709db8d736b9d69c72e6d28863ad Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 7 Dec 2021 10:22:36 +0100 Subject: Add comments --- src/Values.ml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Values.ml b/src/Values.ml index 7b5e9537..9a932fc2 100644 --- a/src/Values.ml +++ b/src/Values.ml @@ -346,7 +346,21 @@ type abs = { which are a special kind of value. *) -class virtual ['self] map_g_value = +(** Monomorphic version of the map visitor for [g_typed_value]. + + The type variables are quantified at the level of the class (not at the + level of each method). As a consequence, the visit methods don't need to + take closures as parameters. + + The polymorphic visitor generated by the visitors macro caused some + trouble: it was in some cases not possible to override a function + to refine the behaviour of a visitor. With this version, it is + possible. Note that this works only because the polymorphism of + [g_value], [g_adt_value], etc. is "uniform": the type instantiation + is always the same. + +*) +class virtual ['self] map_g_typed_value = object (self : 'self) inherit [_] VisitorsRuntime.map -- cgit v1.2.3