Version française
Home     About     Download     Resources     Contact us    
Browse thread
weird type behavior
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] weird type behavior
On Sat, Oct 28, 2006 at 05:49:08PM +0200, Kirill wrote:
> I'm a novice user of OCaml and functional languages in general. While
> playing with the interpreter, writing all kinds of functions, I've run
> into a behavior that doesn't look quite right to me. Please excuse me,
> if it is explained somewhere and I simply haven't gotten there yet.
> 
> In the following example, I define a simple function foo that returns
> function bar, which, in turn, accepts 2 parameters. The weird part is
> that after bar is being called for the first time, its signature changes
> from polymorphic types to ints. Right after (foo 3) call it's
>   '_a -> '_b -> '_b = <fun>
> But after being called, it becomes
>   (int -> int) -> int -> int = <fun>

Type variables like '_a are covered here:

http://caml.inria.fr/pub/old_caml_site/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles

There's a mailing list for beginners' questions:

http://tech.groups.yahoo.com/group/ocaml_beginners/

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!