From: David Monniaux <David.Monniaux@ens-lyon.fr>
To: Caml-list <caml-list@inria.fr>
Subject: bizarrerie du typage
Date: Sun, 12 Jan 1997 20:19:43 +0100 (MET) [thread overview]
Message-ID: <Pine.GSO.3.95.970112201324.25242B-100000@brotteaux> (raw)
J'ai un exemple assez amusant de bizarreries du typage:
Objective Caml version 1.01
#let zero = fun x y -> y;;
val zero : 'a -> 'b -> 'b = <fun>
#let succ = fun n f x -> n f (f x);;
val succ : (('a -> 'b) -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'c = <fun>
#let un = succ zero;;
val un : ('_a -> '_b) -> '_a -> '_b = <fun>
#let deux = succ un;;
val deux : ('_a -> '_a) -> '_a -> '_a = <fun>
#deux (fun x -> x) 0;;
- : int = 0
#deux;;
- : (int -> int) -> int -> int = <fun>
Pourquoi le type de "deux" a-t-il changé?
(cela fait aussi avec la version 1.03)
N'aurais-je rien compris au système de typage du CAML?
Il me semblait pourtant que quand un identificateur était lié à un terme
déjà typé, son type était bien établi (égal à celui de ce terme), et ne
changeait pas...
"Si l'informatique marchait, cela se saurait."
next reply other threads:[~1997-01-13 8:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-12 19:19 David Monniaux [this message]
1997-01-13 11:41 ` Eric HASSOLD
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=Pine.GSO.3.95.970112201324.25242B-100000@brotteaux \
--to=david.monniaux@ens-lyon.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