2
我想构建一个F#代码表达式。但我不想通过代码引用来做到这一点,但通过对象构造它。 但是如何做到这一点的文档相当稀少。构建代码表达式“手动”
考虑下面的代码片段
type Foo = { foo = string}
let bar = {foo = "foo"}
let ex = <@ bar.foo @>
这产生了ex
。
PropertyGet (Some (ValueWithName ({foo = "foo";}, bar)), foo, [])
但我简直不能复制上面的确切术语。例如,我没有找到构造函数ValueWithName
上的任何东西。
所以我
<@ bar.foo @> = PropertyGet (Some (ValueWithName ({foo = "foo";}, bar)), foo, [])