How do you use a module-level let binding to bind two private values to records in a tuple?
type private T = {F:int}
let private a = {F=1}
let private b, private c = {F=2}, {F=3}
In this example, a works fine, but the bindings for b and c each fail with the error:
error FS0410: The type
'T'is less accessible than the value, member or type'val patternInput : T * T'it is used in
To see why this doesn’t work, decompile it with Reflector. You’re creating a tuple and immediately destructuring it. In debug mode anyway, the intermediate tuple is created as an
internalfield of the enclosing type (an implementation detail of the pattern match). Of course, that makes it more accessible thanT, which isprivate. I’m curious to know if this is a bug (seems like it).EDIT
It gets weirder…
The following fails to compile (with syntax error), but compiles fine if the types are public and
let, instead oflet private, is used.I think it’s safe to say destructuring in module-level private
letbindings has some problems.