在将一些代码迁移到VS2010 b1中包含的最新版本的F#时,我遇到了一个问题,我想知道是否有可用的解决方法 - 如果没有 - 为什么F#编译器的行为被修改为不支持该方案 .
type Foo(a) =
[<OverloadID("CurriedAbc")>]
member public x.Abc (p:(oneType * anotherType) seq) otherParm = method impl...
//this overload exists for better compatibility with other languages
[<OverloadID("TupledAbc")>]
member public x.Abc (p:Dictionary<oneType, anotherType>, otherParm) =
x.Abc(p |> Seq.map(fun kvp -> (kvp.Key, kvp.Value))) otherParm
此代码生成以下编译时错误:
错误FS0191:此方法的一个或多个重载具有curried参数 . 考虑重新设计这些成员以采用tupled形式的参数
请注意,这曾经在F#1.9.6.2(9月CTP)上完美运行
1 回答
更改的原因在detailed release notes:
由于您的重载只能在第一个参数上解决,因此您应该能够通过将curried版本更改为: