From 2e2d7f6a9b116dac2fa20be657c916cb498c1508 Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Sat, 19 Sep 2026 01:08:28 +0000 Subject: Do not assume that the hash of an object is its storage address --- lib/protocols/Addressable.ml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/protocols/Addressable.ml (limited to 'lib/protocols/Addressable.ml') diff --git a/lib/protocols/Addressable.ml b/lib/protocols/Addressable.ml new file mode 100644 index 0000000..7e97f08 --- /dev/null +++ b/lib/protocols/Addressable.ml @@ -0,0 +1,13 @@ +class type implementation = object + method address : Concepts.Hash.hash +end + +type Handle.protocol += Addressable of implementation + +type t = implementation + +let make impl = Addressable (impl :> implementation) + +let from handle = Handle.into handle (function Addressable impl -> Some impl | _ -> None) + +let address i = Handle.invoke i (fun o -> o#address) -- cgit v1.2.3