5
比方說,我有一大堆的載體類型(一拉XNA),其中一些有靜態成員Cross
:多元數的靜態類型約束
type Vector3 =
...
static member Cross (a : Vector3, b : Vector3) = new Vector3(...)
我可以定義cross
功能,它編譯:
let inline cross (x : ^T) (y : ^T) = (^T : (static member Cross : (^T * ^T) -> ^T) ((x,y)))
不幸的是我不能夠使用它,並以下錯誤:
let res = cross a b
^
The member or object constructor Cross takes 2 argument(s) but is here given 1. The required signature is static member Vector3.Cross : a:Vector3 * b:Vector3 -> Vector3
它甚至可能嗎?感謝您的幫助!
糟糕。是的,它現在起作用!謝謝 :) – Stringer 2010-11-11 15:10:44