caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* bizarrerie du typage
@ 1997-01-12 19:19 David Monniaux
  1997-01-13 11:41 ` Eric HASSOLD
  0 siblings, 1 reply; 2+ messages in thread
From: David Monniaux @ 1997-01-12 19:19 UTC (permalink / raw)
  To: Caml-list

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."







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-14  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-12 19:19 bizarrerie du typage David Monniaux
1997-01-13 11:41 ` Eric HASSOLD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).