Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Pascal Cuoq <Pascal.Cuoq@ens-lyon.fr>
To: lyclaire@ac-grenoble.fr
Cc: caml-list@inria.fr
Subject: Re: Re : Weak types ?
Date: Mon, 9 Feb 1998 15:21:56 +0100 (MET)	[thread overview]
Message-ID: <199802091421.PAA07076@vaise.ens-lyon.fr> (raw)
In-Reply-To: <01bd3330$064565a0$739536c1@pluton.ac.grenoble.fr> from "Moreau" at Feb 6, 98 07:49:10 pm

> let toto y =
>  let id x = x in
> id id y ;;
> 
> this will be of type 'a ->'a
> What is the difference with this :
> 
> let toto = let id x = x in id id ;;
> 
> I thought caml will understand that there is no difference !
> 
> why does caml make this difference ?

the same examples, rewritten:

let id = fun x -> x ;;

let toto = fun y -> id id y ;;

caml: ha, I know the answer to this one : toto is a function.
The evaluation of "fun y -> anything" can not create references,
so type variables can safely be generalized.

let toto = id id ;;

caml: hmmm, I wonder what this toto may be... It is the result
of an application, and I don't know whether I am qualified to
look deeper into the code to check about that.  It might be
anything, I'd better not generalize variables.

About this algorithm, you can think of Caml as of 
Winnie-the-Pooh : it can answer difficult questions in the 
particular cases where the answer is obvious (ie, syntactic). 
Otherwise it doesn't know.

Pascal





      parent reply	other threads:[~1998-02-09 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-06 18:49 Moreau
1998-02-09 13:25 ` Simon Helsen
1998-02-09 14:21 ` Pascal Cuoq [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=199802091421.PAA07076@vaise.ens-lyon.fr \
    --to=pascal.cuoq@ens-lyon.fr \
    --cc=caml-list@inria.fr \
    --cc=lyclaire@ac-grenoble.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