You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1952 Reporter: administrator Status: resolved (set by @damiendoligez on 2013-08-30T21:12:28Z) Resolution: suspended Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general) Related to:#6150 Monitored by: "Julien Signoles"
Bug description
Full_Name: Julien Signoles
Version: 3.06 et 3.07
OS: linux
Submission from: newwww.lri.fr (129.175.15.10)
Bonjour,
Le programme ci-dessous ne type pas alors qu'il devrait...
=====
let x = ref 0
let y = ref true
let f a = x := a
let g a = y := a
(* version "typage explicite + let" : ok *)
let h1 : ('a -> unit) -> 'a -> unit = fun f x -> f x;;
h1 f 0;;
h1 g true;;
let _ =
(* version "typage implicite + let_in" : ok )
let h1 f x = f x in
h1 f 0;
h1 g true;
( version "typage explicite + let_in" : KO )
let h2 : ('a -> unit) -> 'a -> unit = fun f x -> f x in
h2 f 0;
h2 g ( <-- erreur de typage *) true
Julien Signoles
The text was updated successfully, but these errors were encountered:
Le programme ci-dessous ne type pas alors qu'il devrait...
=====
let x = ref 0
let y = ref true
let f a = x := a
let g a = y := a
let _ =
(* version "typage explicite + let_in" : KO )
let h2 : ('a -> unit) -> 'a -> unit = fun f x -> f x in
h2 f 0;
h2 g ( <-- erreur de typage *) true
Ce n'est pas a proprement parler un bug, puisque c'est le comportement prevu du
compilateur (mais je ne suis pas sur qu'il soit clairement documente').
Toutes les variables de types apparaissant dans des annotations sont
considerees
comme liees au niveau le plus exterieur. Elles ne peuvent donc etre rendues
polymorphes que pour les definitions a` toplevel.
Il est parfois question de changer cette semantique... je reclasse donc ca en
feature-wish.
This particular example is resolved by explicit polymorphism, which was introduced in the meantime. Change the type annotation to:
h2 : 'a . ('a -> unit) -> 'a -> unit
and the program typechecks.
I don't know whether we are still considering a change in the binding rule for type annotations.
Original bug ID: 1952
Reporter: administrator
Status: resolved (set by @damiendoligez on 2013-08-30T21:12:28Z)
Resolution: suspended
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Related to: #6150
Monitored by: "Julien Signoles"
Bug description
Full_Name: Julien Signoles
Version: 3.06 et 3.07
OS: linux
Submission from: newwww.lri.fr (129.175.15.10)
Bonjour,
Le programme ci-dessous ne type pas alors qu'il devrait...
=====
let x = ref 0
let y = ref true
let f a = x := a
let g a = y := a
(* version "typage explicite + let" : ok *)
let h1 : ('a -> unit) -> 'a -> unit = fun f x -> f x;;
h1 f 0;;
h1 g true;;
let _ =
(* version "typage implicite + let_in" : ok )
let h1 f x = f x in
h1 f 0;
h1 g true;
( version "typage explicite + let_in" : KO )
let h2 : ('a -> unit) -> 'a -> unit = fun f x -> f x in
h2 f 0;
h2 g ( <-- erreur de typage *) true
Julien Signoles
The text was updated successfully, but these errors were encountered: