I noticed a rather counter intuitive behavior when the field part of the F # record is declared closed. (This is due to Is it possible to make the recording field private? Or to make the recording of the recording private? )
In this example ...
type MyRec = private
... Both private member is not available outside the scope of the type declaration as expected. However, field a available.
If you put MyRec in a module, the fields become private for that module. The way you expect the top-level declaration in a module to behave, but I expected that everything declared private in a type would be closed to this type, and not to its closing module.
Is this behavior really strange, or am I missing something in my reasoning here?
source share