Stdlib.Oo(3)
hiii bestie π welcome to the Stdlib.Oo(3) page, which lives in the OCaml library. This one is short and iconic, so let's get into it. β¨
πΈ NAME πΈ
Stdlib.Oo - no description π. That's literally what the manpage says, bestie. We move.
π Module π
The module line is:
Module Stdlib.Oo
That's the whole section. Slay. π
π Documentation π
Under documentation, it's the Oo module, wired up like this:
Module Oo
: (module Stdlib__Oo)
π¦ copy π¦
val copy : (< .. > as 'a) -> 'a
Oo.copy o returns a copy of object o β and by copy we mean a fresh object with the same methods and instance variables as o. No cap, it's giving duplicate-but-make-it-fresh. β¨
β οΈ Alert unsynchronized_access. Unsynchronized accesses to mutable objects are a programming error. This is a real warning, bestie β don't let unsynchronized access catch you slipping. π
π id π
val id : < .. > -> int
id returns an integer identifying this object, unique for the current execution of the program. The generic comparison and hashing functions are based on this integer. π
But here's the plot twist π: when an object is obtained by unmarshaling, the id is refreshed, and thus different from the original object. As a consequence, the internal invariants of data structures such as hash table or sets containing objects are broken after unmarshaling the data structures. That's a major "protect your invariants" moment, fr fr. π«Ά
mwah π this page was brought to you by the footer energy: source/version OCamldoc, date 2026-06-22, and the page name Stdlib.Oo(3). periodt. π
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms