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 HAA06932; Thu, 7 Aug 2003 07:20:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 HAA17603 for ; Thu, 7 Aug 2003 07:20:48 +0200 (MET DST) Received: from wetware.com (wetware.wetware.com [199.108.16.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h775KlT02681 for ; Thu, 7 Aug 2003 07:20:47 +0200 (MET DST) Received: from 208.177.152.18.ptr.us.xo.net ([208.177.152.18] helo=wetware.com) by wetware.com with esmtp (Exim 4.20) id 19kdCf-0003Fn-LL; Wed, 06 Aug 2003 22:20:45 -0700 Date: Wed, 6 Aug 2003 22:20:44 -0700 Subject: Re: [Caml-list] static class member.... Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: Ocaml Beginners To: The Trade From: james woodyatt In-Reply-To: Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; woodyatt:01 jhw:01 wetware:01 caml-list:01 beginners:01 brogoff:01 functors:01 avoiding:01 variance:01 annotations:01 newbie:01 village:99 ocaml:01 caml:01 speakeasy:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [please reply to ocaml_beginners@yahoogroups.com] On Wednesday, Aug 6, 2003, at 09:12 US/Pacific, on the main Ocaml mailing list, brogoff@speakeasy.net wrote: > > As a side advice to the OP, it would be worthwhile to avoid the OOP > and just > get used to the ML part of Caml first. I would strongly second this advice. When I came to Ocaml from C++, I did not heed this advice-- and I wasted a lot of time learning why that was a mistake. In fact, the first piece of advice I would pass along to Java/C++ programmers who are new to Ocaml is this: + Don't use classes unless functors and module inclusion fail to satisfy your requirements. There are many fine ways to obtain the kinds of relationships in the Ocaml type system that C++ and Java both only use classes to offer. In Ocaml, the object class and class type semantic is only one of the ways to skin a particular kind of cat. It's not, in fact, the most straightforward one either. Until you understand the tradeoffs for choosing it, I recommend avoiding it. You can do *almost* everything with 'functor' and 'include' and/or phantom polymorphic variant type parameters on abstract types with parameter variance annotations. That said, the class and class type semantic is an indispensable aspect of the language, from my point of view. It's just not very easy explaining why I say that to a newbie. -- j h woodyatt that's my village calling... no doubt, they want their idiot back. ------------------- 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