让我们说一些奇怪的原因我想有这样的功能:F#运算符重载奇怪behavoir
let (~-) (str:string) = 42
所以我可以做这样的事情,并得到42结果:
-"test"
val it : int = 42
哪很好。但现在,当我做:
let a = 100
-a
我得到:
error FS0001: This expression was expected to have type
string
but here has type
int
任何想法,为什么会出现这种情况?