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)
是類型檢查。