Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Didier Remy <Didier.Remy@inria.fr>
To: David Monniaux <David.Monniaux@ens.fr>
Cc: Liste CAML <caml-list@inria.fr>
Subject: Re: generalization in tuples
Date: Tue, 17 Oct 2000 21:17:58 +0200	[thread overview]
Message-ID: <20001017211757.A24092@morgon.inria.fr> (raw)
In-Reply-To: <20001017101155.A16955@morgon.inria.fr>

>         let x = (let y = fun x -> x in ref y, y)
>                  : ('a -> 'a) ref * ('a -> 'a)

Indeed, as Michel Mauny pointed out to me, this expression would have type:

          let x = (let y = fun x -> x in ref y, y)
                   : ('a -> 'a) ref * ('b -> 'b)

thus 'b appearing only in a non-expansive expression could be also
generalized here. (BTW, the context "let x = v in [ ]" is non-expansive
whenever v is)

I meant to create the situation where a type variable appears on both
side of a product, when one side is expansive, this other is not, and the
context of the product is non-expansive. But I can't think of a ``natural''
example of this. The usual trick: 

          let x = (fun (y : 'a) -> ref y, y) (fun x -> x)
                   : ('a -> 'a) ref * ('a -> 'a)

does not work, because the whole expression becomes an application and is
expansive. I can only think of using an artifial typing constraint:

          let x = (let y = fun x -> x in ref (y : 'a), (y : 'a))
                   : ('a -> 'a) ref * ('a -> 'a)

> Here 'a appears both in an outer expansive expansive expression and in a
> non-expansive expressions. Hence it is dangerous can cannot be generalized. 

Funny! it is so difficult to stop type generalization...

        Didier




      reply	other threads:[~2000-10-18  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-16 12:42 David Monniaux
2000-10-17  8:11 ` Didier Remy
2000-10-17 19:17   ` Didier Remy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001017211757.A24092@morgon.inria.fr \
    --to=didier.remy@inria.fr \
    --cc=David.Monniaux@ens.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox