From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA10520; Sat, 13 Jul 2002 15:40:58 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA10712 for ; Sat, 13 Jul 2002 15:40:57 +0200 (MET DST) Received: from hickory.cc.columbia.edu (hickory.cc.columbia.edu [128.59.59.202]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6DDeuf28087 for ; Sat, 13 Jul 2002 15:40:56 +0200 (MET DST) Received: from there (tw304h3.cpmc.columbia.edu [156.111.84.180]) by hickory.cc.columbia.edu (8.9.3/8.9.3) with SMTP id JAA07158 for ; Sat, 13 Jul 2002 09:40:55 -0400 (EDT) Message-Id: <200207131340.JAA07158@hickory.cc.columbia.edu> Content-Type: text/plain; charset="iso-8859-1" From: Oleg To: caml-list@inria.fr Subject: [Caml-list] Five Questions about Objects Date: Sat, 13 Jul 2002 09:42:47 -0400 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi A few questions on objects: 1) Why does the following code define a polymorphic class class point a b = object val x = a val y = b end;; but adding "method get () = (x, y)" results in type errors only resolvable by specifying types with "class ['a, 'b] point (a:'a) (b:'b)" ? Why doesn't class point a b = object val x = a val y = b method get () = (x, y) end;; give me a polymorphic class? 2) What is the point of "class" and "new" keywords? How are they better than "let" ? E.g. let point a b = object val x = a val y = b method get () = (x, y) end;; let my_point = point 3 7;; let many_float_points = Array.make 100 (point 4.0 3.0);; ? 3) Is it possible to access object datafields directly or only through methods? 4) Can I construct an object that the following function f would accept? # let f a = a#m1 (); a#b#m2 ();; val f : < b : < m2 : unit -> 'a; .. >; m1 : unit -> 'b; .. > -> 'a = I tried the obvious (to me) and it doesn't work. What is the precedence and associativity of #? 5) What is the current state of marshalling objects? Is Jacques's patch going to be used in the upcoming O'Caml version or is it too untested? Thanks Oleg ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners