diff options
Diffstat (limited to 'lib/model/reference.ml')
| -rw-r--r-- | lib/model/reference.ml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/model/reference.ml b/lib/model/reference.ml index 496eb9d..67bbcaf 100644 --- a/lib/model/reference.ml +++ b/lib/model/reference.ml @@ -1,4 +1,11 @@ -type t = T : t Content.t Lazy.t -> t [@@unboxed] +(** A lazy pointer to a resolved content. The payload is + [t Typ.target Content.t] — i.e. {!Model.content} — and is only forced once + every content has been registered (see [Configuration.Ast.check]), which + is what allows cyclic references between contents. *) +type t = T : t Typ.target Content.t Lazy.t -> t [@@unboxed] -let v : (unit -> t Content.t) -> t = fun f -> T (lazy (f ())) -let get : t -> t Content.t = fun (T target) -> Lazy.force target +let v : (unit -> t Typ.target Content.t) -> t = + fun f -> T (lazy (f ())) + +let get : t -> t Typ.target Content.t = fun (T target) -> + Lazy.force target |
