Browse thread
simple example of using ocamlbuild with C
-
Ashish Agarwal
-
Matthieu Dubuget
-
Axel_Poigné
- Jacques GARRIGUE
- Ashish Agarwal
-
Axel_Poigné
-
Matthieu Dubuget
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques GARRIGUE <garrigue@m...> |
| Subject: | Re: [Caml-list] Type checking question |
From: Axel Poigné <axel.poigne@iais.fraunhofer.de> > why does this work [...] > #class yyy (x:int) = > object(self) > inherit xxx x > method set y = _x <- y > end;; > class yyy : int -> > object val mutable _x : int method get : int method set : int -> unit end > #let yy = new yyy 8;; > val yy : yyy > > I would expect that yy is of not type yyy = int -> ... The confusion is due to the fact a class definition actually defines 4 things: * the class itself, whose type is displayed * a class type with same name, which is the displayed type _without_ the parameters (here, without int ->) * an object type with same name, which is constructed from the public methods of the class type * an extensible object type #yyy, which is unifiable with any subclass of yyy. The yyy in "new yyy" is the class, but the one in "val yy : yyy" is the object type. Jacques Garrigue