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: 163 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Je suis tombé sur un comportement bizarre du typeur d'OCaml 3.00+7
lorsqu'on mélange classes et foncteurs:
module A = struct class c = object method m = 1 end end;;
module A : sig class c : object method m : int end end
(new A.c)#m;;
: int = 1
(* Jusqu'ici, tout va bien. Maintenant, ajoutons un foncteur. *)
module F(X: sig class c : object method m : int end end) =
struct
class d = object (self) inherit X.c method n = 1 + self#m end
end;;
module F :
functor (X : sig class c : object method m : int end end) ->
sig class d : object method m : int method n : int end end
module B = F(A);;
module B : sig class d : object method m : int method n : int end end
(* Ça va bien aussi. Mais: *)
(new B.d)#n;;
This expression has type d
It has no method n
(* Allo? Mais quel est le type de (new B.d) ? *)
new B.d;;
: d =
(* Ce "d" me semble fortement libre! *)
Ce que je ne comprends pas, c'est pourquoi le "recalage" de c en A.c
marche pour A, alors que d n'est pas "recalé" en B.d.
Xavier
The text was updated successfully, but these errors were encountered:
Original bug ID: 163
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Je suis tombé sur un comportement bizarre du typeur d'OCaml 3.00+7
lorsqu'on mélange classes et foncteurs:
module A = struct class c = object method m = 1 end end;;
module A : sig class c : object method m : int end end
(new A.c)#m;;
: int = 1
(* Jusqu'ici, tout va bien. Maintenant, ajoutons un foncteur. *)
module F(X: sig class c : object method m : int end end) =
module F :
functor (X : sig class c : object method m : int end end) ->
sig class d : object method m : int method n : int end end
module B = F(A);;
module B : sig class d : object method m : int method n : int end end
(new B.d)#n;;
This expression has type d
It has no method n
new B.d;;
: d =
(* Ce "d" me semble fortement libre! *)
Ce que je ne comprends pas, c'est pourquoi le "recalage" de c en A.c
marche pour A, alors que d n'est pas "recalé" en B.d.
The text was updated successfully, but these errors were encountered: