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 LAA24122; Sun, 14 Jul 2002 11:39:06 +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 LAA24120 for ; Sun, 14 Jul 2002 11:39:05 +0200 (MET DST) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6E9d3f20950 for ; Sun, 14 Jul 2002 11:39:03 +0200 (MET DST) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id SAA18404; Sun, 14 Jul 2002 18:38:48 +0900 To: frisch@clipper.ens.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Five Questions about Objects In-Reply-To: References: <20020714095816B.yoriyuki@mbg.sphere.ne.jp> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020714183842E.garrigue@kurims.kyoto-u.ac.jp> Date: Sun, 14 Jul 2002 18:38:42 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Alain Frisch > On Sun, 14 Jul 2002, YAMAGATA yoriyuki wrote: > > > However, I wonder why a class is necessary in the first place. I'm > > not familiar with the theory of OOP, but I feel like direct creation > > of objects is possible in functional languages. > > It is already possible in OCaml, thanks to local modules: > > "object ... end" > ===> > let module M = struct class o = object ... end end in new M.o > > It would be straightforward to define a Camlp4 syntax extension for this. This only works if your object has a monomorphic type. The real point is that if object definitions were really first class in the language, they would not be restricted by these strange variable binding conditions: type inference would be enough. Since there is no theoretical problem here, it may well be a useful extension. Jacques Garrigue ------------------- 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