Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

Cheers,

   - Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

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