2752Re: "ocaml_beginners":: Re: 'ocaml_beginners':: Execution semantics
- Nov 5, 2004On Fri, 5 Nov 2004 12:59:29 +0000, Alwyn <dt015a1979@...> wrote:
>Well not exactly, if the value on the right hand side of the = is an
> On 5 Nov 2004, at 08:57, Seth J. Fogarty wrote:
> > I'm still slightly bothered by the fragility with which '_a is
> > introduced or not.
> It's called 'value restriction'. For full polymorphism, the expression
> on the right hand side of the '=' sign must be a value.
hashtable for example, it is a value, but it won't be polymophic (it
would be realy unsafe). Only imutable value will be generalize (that
is render fully polymorphic). Well, not exactly this, it will be
generalize if the type polymorphisme is covariant (and I believe there
is another restriction).
A type 'a t is covariant with regard to a, if for any type a and b
such that one can coerce any value of type a in a value of type b,
then one can coerce a value of type a t into a value of type b t. For
example the option type is covariant.
- << Previous post in topic Next post in topic >>