From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA12633 for caml-redistribution@pauillac.inria.fr; Wed, 3 Nov 1999 21:54:56 +0100 (MET) Resent-Message-Id: <199911032054.VAA12633@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA25397 for ; Tue, 2 Nov 1999 14:11:38 +0100 (MET) Received: from hugo.int-evry.fr (hugo.int-evry.fr [157.159.100.81]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id OAA19508 for ; Tue, 2 Nov 1999 14:11:38 +0100 (MET) Received: from jones.int-evry.fr (jones [157.159.100.35]) by hugo.int-evry.fr (8.8.8/jtpda-5.3) with ESMTP id OAA00871 ; Tue, 2 Nov 1999 14:11:31 +0100 (MET) Received: (rinderkn@localhost) by jones.int-evry.fr (8.8.8/8.6.4) id OAA16644; Tue, 2 Nov 1999 14:09:52 +0100 (MET) Date: Tue, 2 Nov 1999 14:09:52 +0100 From: Christian RINDERKNECHT To: caml-list@inria.fr Cc: Christian RINDERKNECHT Subject: [Q] Four micro-questions on objects and modules. Message-ID: <19991102140952.A16438@jones.int-evry.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 0.95.5i Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 3 Nov 1999 21:54:56 +0100 Resent-To: caml-redistribution@pauillac.inria.fr Hello, I have a few questions on objects and modules. 1) Assume I compile m.ml made of: class c = object end and m.mli: class c : object end Now: Objective Caml version 2.02 # #load "m.cmo";; # let f = fun (x : #M.c) -> x;; val f : (#M.c as 'a) -> 'a = OK. What strikes me is: # let g = fun (x : M.c) -> x;; val g : M.c -> M.c = What is the difference between f and g? If the type of g is equivalent to #M.c -> #M.c, then according to the manual (#-types) there is a difference, isn'it? Moreover, I tought "M.c" was not syntactically correct when "c" is a class (hence the "#" symbol)... 2) What is the semantics of the syntactic productions (http://caml.inria.fr/ocaml/htmlman/node6.5.html): typexpr : typexpr # class-path | ( typexpr {, typexpr}) # class-path 3) Would it be possible to allow the "include" feature in class types? 4) With values one can equivalently write: # let (h : unit -> unit) = fun x -> x;; val h : unit -> unit = or # let h = ((fun x -> x) : unit -> unit);; val h : unit -> unit = I prefer the former when the function expression is big and I don't want my eyes to read it only in order to find the type annotation at the end. For the same sake, I think it would be consistent and useful to allow class types, module types to qualify directly the module names and the class names: # module (M : S) = struct (* lot of stuff here *) end;; ^ Not a Syntax error! and # class (x : ct) = object (* lot of stuff here *) end;; ^ Not a Syntax error! ...and the same for method and value instances. Best regards, -- Christian ----------------------------------------------------------------------- Christian Rinderknecht Phone +33 (0)1 60 76 44 43 Institut National des Télécommunications Fax +33 (0)1 60 76 47 11 Département Logiciels Réseaux (LOR) WWW 9, Rue Charles Fourier, F-91011 Évry Cedex