`type private MyRecord = {...}` 和 `type MyRecord = private {...}` 有什么区别

What's the difference between `type private MyRecord = {...}` and `type MyRecord = private {...}`

有什么区别

type private MyRecord =
    { id : int }

type MyRecord = private
    { id : int }

根据我的阅读:

如评论所示,您已经大功告成了。有趣的是,F# Language Specification 中并未明确提及这一事实,但可以从尝试将记录字段设为私有时产生的错误推断出来,例如type MyRecord = { private id : int }

Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation.

实际上,如果您将 "the whole representation" 设为私有,则您无法构造记录,也无法访问可访问性修饰符范围之外的字段。