將某些代碼遷移到VS2010 b1中包含的最新版本的F#時,遇到問題,我想知道是否有可用的解決方法 - 如果沒有 - 爲什麼F#編譯器的行爲被修改爲不支持該場景。F#:curried過載/元組過載問題
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
此代碼將產生以下編譯時錯誤:
error FS0191: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form
請記住這用來在F#1.9.6.2(9月CTP)
感謝您指出的標題問題,我寫了,我必須去解決,然後另外一個問題一個問題這一個來了,我只是忘了標題:( PS:我現在正在測試你的解決方案,看看它是否工作:D – em70 2009-05-28 13:20:00