Oo(3)

✨ Oo(3) ✨ β€” OCaml library, bestie πŸ’…

okay so this is the <pink>Oo</pink> page from the OCaml library manual, and it's literally all about Operations on objects πŸŽ€. it's short, it's iconic, and honestly it ate.


🌸 NAME 🌸

Oo β€” operations on objects 🫢


πŸ¦‹ Module πŸ¦‹

Module Oo ✨

no cap, that's the whole module line. she's minimal, she's mysterious, she's giving main character energy.


πŸ’– Documentation πŸ’–

Module Oo
 : sig end

so yeah β€” the module is Oo, and its signature lives between that sig and that end πŸŽ€. cute little self-contained vibe.

Operations on objects β€” that's the whole tagline, and honestly? slay.


⭐ 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 πŸ’…. same fit, new body, iykyk.

⚠️ Alert unsynchronized_access. Unsynchronized accesses to mutable objects are a programming error. fr fr, do not come crying to me after you race two threads on the same mutable object 😭 β€” that's on you, bestie.

πŸ”₯ val id : < .. > -> int

returns an integer identifying this object, and it's unique for the current execution of the program πŸ‘‘. it's basically the object's government name for this run only.

the generic comparison and hashing functions are based on this integer. so like, everything downstream leans on id β€” keep that in mind 🧠✨.

and here's the tea πŸ“: when an object is obtained by unmarshaling, the id is refreshed, so it's different from the original object's id. as a consequence, the internal invariants of data structures such as hash table or sets containing objects are broken after unmarshaling the data structures πŸ’€πŸ˜­.

big warning energy: unmarshal an object that's sitting inside a hash table or a set and the invariants are toast. not me finding out the hard way. πŸ™ˆ

that's it, that's the page β€” short but she served πŸ’œ. this was OCamldoc, dated 2026-06-22, footer Oo(3), and yes the doc said OCamldoc so we're crediting OCamldoc periodt 🌈✨. mwah, go write some objects πŸ’‹

πŸ“¦ where this page comes from