Search code examples
oopumlocamlanonymous

UML for OCaml immediate objects


I have created an immediate object in OCaml.

let x = 
object (self)
val dataMember = 3
method aMethod = print_endline "Called a method"
end;;

As the object doesn't have a name (is it considered anonymous?), how can it be correctly represented in UML?

Thanks.


Solution

  • You could give it a nonce-name, or some other formulaic value. "Correctly" in this context really just means something that will be clear. There is no "right answer" handed down from the International UML Standards Body or anything.

    If you want a more concrete answer, why not call it something like Anonymous_foo_mungler where "foo_mungler" is replaced with the descriptive name you would have given it if it weren't anonymous.