-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Labels
Description
it still makes sense to allow create js classes in ocaml, we can do functional object oriented programming, the benefit is that methods are attached to object, think about it, if we want to
customize comparison behavior for int64, one possible way is below (tricky parts like how to handle this etc)
currently we can do this
function Int64(lo,hi){
this.lo = lo;
this.hi = hi;
}
Int64.prototype.compare = ..class type t = object
method lo__r : nativeint
method hi __r : nativeint
method compare__2 : t -> int
end
external create : nativeint-> nativeint -> t = "Int64" [@@js.new]
external compare : t -> t -> int = "compare" [@@js.send]It would be nice that we can do it all in ocaml