From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 37AE1BB9A for ; Tue, 8 Nov 2005 23:00:47 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jA8M0k9D022361 for ; Tue, 8 Nov 2005 23:00:46 +0100 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 XAA19365 for ; Tue, 8 Nov 2005 23:00:46 +0100 (MET) Received: from conn.mc.mpls.visi.com (conn.mc.mpls.visi.com [208.42.156.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA8M0jZm001403 for ; Tue, 8 Nov 2005 23:00:45 +0100 Received: from [192.168.42.2] (bhurt.dsl.visi.com [208.42.141.66]) by conn.mc.mpls.visi.com (Postfix) with ESMTP id 56231815F; Tue, 8 Nov 2005 16:00:44 -0600 (CST) Date: Tue, 8 Nov 2005 16:04:42 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: brogoff Cc: caml-list Subject: Re: Ant: [Caml-list] The "Objective" part of Objective Caml In-Reply-To: Message-ID: References: <20051107214110.46596.qmail@web26805.mail.ukl.yahoo.com> <87acggxguw.fsf@mid.deneb.enyo.de> <1131414473.23991.37.camel@rosella> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 4371200E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4371200D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 downcasting:01 ocaml:01 usefull:01 usefull:01 inherently:01 runtime:01 2005,:98 posses:98 ...:98 wrote:01 exception:01 dynamically:01 typing:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 8 Nov 2005, brogoff wrote: >> I think I'm with Skaller here- Objects in Ocaml are much less powerfull >> than they are in (for example) Java or Python. > > They're not "much less powerful" than they are in Java. They certainly lack > some features of the Java object system, but they posses many others. If > "powerful" means "supports multiple inheritance", Java is far less powerful. > If it means "supports" downcasting, ... Also, the structural typing in Ocaml allows for some neat tricks that are basically impossible in Java. I suppose it depends upon what you mean by "powerful" more or less. I meant it in terms of "widely usefull". Objects are usefull in Ocaml, but you can write large and very complex programs without them. It's impossible to even write "hello, world" in Java without objects. > As far as static vs dynamic, dynamic type systems are inherently more > capable. There is no "slack" in a dynamically typed language. But the > possibility of a runtime exception is of course there. Yes. For example, Ocaml will reject this code: let f n = if (n > 0) && (is_prime (2*n)) then "bad idea" else false ;; despite the fact that "bad idea" will never, ever be returned (given the obvious definition of is_prime, anyways). But if we restrict ourselves to the domain of correct programs, now I'm not so sure. Well, maybe, in the extreme fringes, there are correct programs which are being disallowed by the Ocaml type systems. I've only been programming in Ocaml a couple of years now- I may just have not run across them yet. But everything I've wanted to do in Ocaml I've been able to do, working with the type system and not against it. > The flip side of this is that OCaml is like Perl, with lots of ways to do > things, and many overlapping features. The fact that OCaml has classes and > modules is good, and that's how I think OO languages should be, but I would > expect that protection and hiding be done only by modules and not objects. To my knowledge, they are. How do you declare a private or protected method for a class variable *without* using modules to do so? Brian