我有两条具有父子关系的记录:
type Parent =
{ Number: int
Child: Child }
and Child =
{ String: string
Parent: Parent }
我尝试使用以下语法初始化这些,但不起作用:
let rec parent =
{ Number = 1
Child = child }
and child =
{ String = "a"
Parent = parent }
这将导致
parent : Parent = { Number = 1
Child = null }
child : Child = { String = "a";
Parent = { Number = 1
Child = null } }
如何在不依赖可变字段或事后复制和更新的情况下初始化这些with
?