diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-09-19 01:08:28 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-09-19 01:09:24 +0000 |
| commit | 2e2d7f6a9b116dac2fa20be657c916cb498c1508 (patch) | |
| tree | 94d39b1c49f69d1ca851e6e53b80297e603546bf /lib/protocols/Handle.ml | |
| parent | c80121c23a90c60b9975e04a49d98c8dfb4866a1 (diff) | |
| download | RNT-2e2d7f6a9b116dac2fa20be657c916cb498c1508.tar.gz RNT-2e2d7f6a9b116dac2fa20be657c916cb498c1508.zip | |
Do not assume that the hash of an object is its storage address
Diffstat (limited to 'lib/protocols/Handle.ml')
| -rw-r--r-- | lib/protocols/Handle.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/protocols/Handle.ml b/lib/protocols/Handle.ml index 524386b..313a3d4 100644 --- a/lib/protocols/Handle.ml +++ b/lib/protocols/Handle.ml @@ -1,5 +1,12 @@ type protocol = .. +module Error = struct + open Concepts.Condition + + let unimplemented_protocol () = condition "unimplemented-protocol" "A required protocol was not implemented by the specified object" + empty +end + class type obj = object method reference : bool method release : unit @@ -45,3 +52,5 @@ let release ({ valid; _ } as handle) = let o = object_of handle in valid := false; o#release + +let require f h = Option.to_result ~none:(Error.unimplemented_protocol ()) (f h) |
