by Jon Harrop <jon@[EMAIL PROTECTED]
>
Apr 28, 2008 at 02:43 PM
raould wrote:
> Not that you need such a hack since there seems to have been a slew of
> folks coming up with extentions to HM that play nice. But I was
> wondering if one could approximate
>
> /* horrible pseudocode */
> id x = x : 'a -> 'a.
> foo i:int s:string = Pair(id i, id s) : int -> string ->
> Pair(int,string).
>
> in regular old non-System-F supporting HM systems by generating (sorta
> like C++ template expansion) a new version of id for every type it is
> applied to in foo. Sort of a macro expansion.
Yes. F#'s structurally-typed "inline" functions do exactly this. These
functions are stored as CIL metadata and instantiated by the F# compiler
when used before being type-specialized at JIT compile time by the CLR.
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u