Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Type inference question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-04-26 (13:42)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: [Caml-list] Type inference question
Mark Shinwell wrote:
> However, in the Marshal example above, we have
> 	Marshal.from_channel stdin []
> in the first part of the "let".  In the SML terminology, this is not a
> "nonexpansive expression"[*] (unlike "fun x -> x").  Therefore, I would
> have thought that the appearance of such an expression here would
> prohibit generalisation (in order to prevent possible unsoundness in the
> presence of mutable state).  This is presumably not the case in OCaml:
> can someone explain why?

Recent versions of OCaml employ a slightly relaxed variant of the value 
restriction that allows generalising of variables in covariant position, 
because that is always safe.


   - Andreas

Andreas Rossberg,

Let's get rid of those possible thingies!  -- TB