Given the following:
module MyModule =
let myObj = new MyObj()
type MyType() =
static let myObj_ = new MyObj()
static member myObj = myObj_
… are MyModule.myObj and MyType.myObj functionally (no pun intended) equivalent?
Whenever I call MyModule.myObj or MyType.myObj, I don’t want the code to actually create a new object. I just want access to methods on a singleton object. I’m hoping that either of the above are suitable to that purpose.
Try it and see? I think these are the same, but I think you can author a MyObj type with a constructor that prints something and then easily verify the behavior with a short test program. (Or maybe you’re asking about something else I’m unclear about.)