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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 28BEABB9A for ; Tue, 8 Nov 2005 19:16:58 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA8IGvLG009328 for ; Tue, 8 Nov 2005 19:16:57 +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 TAA14054 for ; Tue, 8 Nov 2005 19:16:57 +0100 (MET) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA8IGs1W009323 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 8 Nov 2005 19:16:56 +0100 Received: (qmail 12863 invoked from network); 8 Nov 2005 18:16:52 -0000 Received: from shell3.sea5.speakeasy.net ([69.17.116.4]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 8 Nov 2005 18:16:52 -0000 Date: Tue, 8 Nov 2005 10:16:52 -0800 (PST) From: brogoff To: 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 X-Miltered: at concorde with ID 4370EB99.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4370EB96.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 ocaml:01 downcasting:01 inherently:01 runtime:01 variants:01 subsumed:01 overloading:01 overloading:01 clos:01 reuse:01 2005,:98 2005,:98 posses:98 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 Mon, 7 Nov 2005, Brian Hurt wrote: > On Tue, 8 Nov 2005, skaller wrote: > > >>> The object oriented part of OCaml is roughly speaking > >>> just as capable as that of Python, C++, Java, C# etc. > >> > >> Sure, I don't doubt that. > > > > I do. The Python system is much more 'capable' and much less 'robust'. > > This is typical for dynamic typing vs static typing. > > 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, ... 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. > For example, objects in > Ocaml can not have non-virtual (non-overloadable) methods, or static > (global) methods. So patterns like singletons are hard to implement with > Ocaml objects. > > But that's OK- because Ocaml provides other ways to provide those > capabilities. The problem I have with a lot of pure-OO languages is the > need to make objects do everything. 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. So, while I agree that a truly pure OO language is excessive, having a language with tuples/records/variants/exceptions/... subsumed by the object system, and a separate module system for namespace control is a reasonable approach. > Ocaml is to use modules, not objects. If you're not using the true power > of objects- inheritance, virtual functions, > and overloading- Overloading is not an OO feature. Algol-68 and Ada 83, amongst others, had overloading. While Java supports static overloading, languages like CLOS and Dylan support generic functions with multiple dispatch, which is far more powerful. I do use classes when I want to reuse "record" field names, but that's hardly OO. I suppose it is a kind of overloading though. -- Brian