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 OAA17030; Sat, 20 Jul 2002 14:56:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA17034 for caml-list@pauillac.inria.fr; Sat, 20 Jul 2002 14:56:49 +0200 (MET DST) 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 EAA20016 for ; Sun, 14 Jul 2002 04:46:22 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from sccmmhc02.mchsi.com (sccmmhc02.mchsi.com [204.127.203.184]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6E2kKj11232 for ; Sun, 14 Jul 2002 04:46:21 +0200 (MET DST) Received: from blue.weeg.uiowa.edu ([12.217.240.97]) by sccmmhc02.mchsi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020714024619.FCAV25309.sccmmhc02.mchsi.com@blue.weeg.uiowa.edu> for ; Sun, 14 Jul 2002 02:46:19 +0000 Message-ID: <3D30E4DC.1000108@blue.weeg.uiowa.edu> Date: Sat, 13 Jul 2002 21:41:32 -0500 From: Brian Smith User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.8+) Gecko/20020222 X-Accept-Language: en-us MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Five Questions about Objects References: <200207131340.JAA07158@hickory.cc.columbia.edu> <20020714095816B.yoriyuki@mbg.sphere.ne.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk YAMAGATA yoriyuki wrote: > From: Oleg > Subject: [Caml-list] Five Questions about Objects > Date: Sat, 13 Jul 2002 09:42:47 -0400 > > >>let point a b = >> object >> val x = a >> val y = b >> method get () = (x, y) >> end;; >> > > I think You can't do like this. object ... end is a part of a class > definition, and not an ordinary expression. > > 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. I think that the "class" and "class type" constructs are useful when expressing the relationship between types/classes. For example, "let point a b..." defines a function that creates an object. But, what does (x :> point) mean when point is a function instead of a class type? If anything, I would thing that (f :> g) would mean that the return type and parameter types of f follow the covariant/contravariant rules for methods. Similarly, what would the #point construct mean? Also, class types are types, and classes define implicit types, so I think that the class syntax should be close to the syntax for defining other kinds of types, instead of the syntax for defining functions. - Brian ------------------- 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