我想在结构 a 中声明一个中缀运算符以在结构外使用。但即使结构已打开,我似乎也无法在结构外识别“中缀”。下面是一个使用 Poly/ML 的示例:
> structure A = struct infix 6 ++ fun a ++ b = a + b end;
structure A: sig val ++: int * int -> int end
> 1 A.++ 2;
poly: : error: Type error in function application.
Function: 1 : int
Argument: A.++ : int * int -> int
Reason: Value being applied does not have a function type
Found near 1 A.++ 2
Static Errors
> let open A in 1 ++ 2 end;
poly: : error: Type error in function application.
Function: 1 : int
Argument: ++ : int * int -> int
Reason: Value being applied does not have a function type
Found near let open A in 1 ++ 2 end
Static Errors
这是标准 ML 的限制吗?