Version française
Home     About     Download     Resources     Contact us    
Browse thread
Why + vs +. but "fake" parametric polymorphism for <
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Why + vs +. but "fake" parametric polymorphism for <
That's correct. As showed, specifying types somewhere (as I did with
the return type, and someone else did for a given parameter), type
inference deduces the types of the parameters and return values,
allowing it optimise.

let f x y : <t> = .... specifies the return type, or to annotate a
parameter, use (x:<t>) -- the parentheses are required, and <t> is a
placeholder for the type expression.

On 10/12/06, Carlos Pita <cpitaper@yahoo.com.ar> wrote:
>
> > Of course there is an overhead. But the compiler is clever enough to
> > remove this overhead when the types of arguments are statically known.
> > In particular this is true for floats.
>
> Oh, I see, so if I understand you it would be enough if I use an integer
> literal somewhere or explicitly declare some variable as int so the
> compiler can infer that the particular use of the comparison operator is
> being passed integer operands and consequently inline an specific,
> optimized-for-int, version of <. Am I wrong?
> Cheers,
> Carlos
>
>
>
>
>
> __________________________________________________
> Preguntá. Respondé. Descubrí.
> Todo lo que querías saber, y lo que ni imaginabas,
> está en Yahoo! Respuestas (Beta).
> ¡Probalo ya!
> http://www.yahoo.com.ar/respuestas
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>