0
'#'在以下签名中的含义是什么?#字符在js_of_ocaml dom类型前的含义
val insertBefore : #node Js.t -> #node Js.t -> #node Js.t Js.opt -> unit
'#'在以下签名中的含义是什么?#字符在js_of_ocaml dom类型前的含义
val insertBefore : #node Js.t -> #node Js.t -> #node Js.t Js.opt -> unit
参见OCaml的参考手册(http://caml.inria.fr/pub/docs/manual-ocaml/types.html)的#-types
部分。
函数类型#node -> t
需要类node
或其子类的对象,并返回t
。
例如,
class c = object method x = 1 end
let g : #c -> int = fun o -> o#x
功能g
可以采取c
类或它的子类的一个对象。 #c
因此的< x : int; ..>
的缩写,
let h = (g : < x : int; ...> -> int)
是类型检查。