views:

114

answers:

2

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.

+1  A: 

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.

MarkusQ
agreed. My experience with UML has been ad-hoc, but I cannot think of anything useful to answer your question either. It's about documenting the program, and doesn't affect the program itself. Possibly the module that it's located, and a descriptive name that is in the comments?
nlucaroni
+1  A: 
Ted Johnson