Open marler8997 opened 5 years ago
I never considered this a big issue. On the contrary, I quite like that for testing you can introspect into the class if you want to. (though I don't have a strong feeling about this)
Yeah, white box testing is good and this problem of accessing private fields is a common one in any language. One idea is to have the language grant visibility to all private fields if it's inside a unittest
block or version(unittest)
.
Or have a fileprivate
scope or public/protected/private/package/module
. Or package(this)
to mean module. Or private(this)
to mean "real" private and don't change the current private.
In my opinion,
private
should mean private to the class/struct, not to the module. I thinkmodule
ownership is a fine idea, but should be have it's own visibility.