Browse thread
Recursive subtyping issue
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-03-01 (12:28) |
From: | Stéphane Glondu <steph@g...> |
Subject: | Re: [Caml-list] Recursive subtyping issue |
Guillaume Yziquel a écrit : > Because subtyping seems more efficient than applying a noop function. > And this code might run really often, so I do not like very much the > idea of having noop functions running really often. FWIW, I don't think you have any penalty if you declare your identities as externals like Obj.{repr,obj,magic}. Yuk, some might say... but we are in the context of bindings to other languages anyway. > Moreover, having conversion functions is not really handy, from a > syntactic point of view: It's quite convenient to write something like > > let f : string -> obj :> string -> float t = blah blah blah... > > than doing the explicit, runtime, casting in the definition of f. It's more convenient for me write letters and parentheses than the symbol ":>" :-) IIUC, these conversion function are not to be used often, are they? What you want is the equivalent of Obj.{repr,obj}, but for values of some other language, right? Are you planning to leak your "tau", "typed" and "untyped" types out of the module? If so, inferred types are likely to refer to those, which might be very confusing (unless you resort to a lot of type annotations). If not, you'll have to use explicitly the coercion functions outside of the module anyway. -- Stéphane