gpt4 book ai didi

F#引用生成非常奇怪的编译错误

转载 作者:行者123 更新时间:2023-12-01 04:54:11 26 4
gpt4 key购买 nike

我想弄清楚为什么会出现以下行:

let emailQuotation: Expr<LoginView -> string> = <@ fun (v: LoginView) -> v.Email.Text @>

因编译错误而失败,说“在不确定类型上查找对象...”。属性(property) ViewModel.Email是 Xamarin 表单 Entry ,包含 Text属性(property)。

编译器还需要什么信息,为什么它不能解释这个表达式?

最佳答案

我的解决方案是丑陋的。我可以做这个:

let emailQuotation = <@ fun (v: LoginView) -> let email: Entry = v.Email in email.Text @>

引用无法解释 v.Email 的类型.我不是代码引用方面的专家,所以可能有一种方法可以让编译器在单个表达式中选择类型。

关于F#引用生成非常奇怪的编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38704808/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com