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 XAA30853; Wed, 14 Feb 2001 23:15:07 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA31022 for caml-list@pauillac.inria.fr; Wed, 14 Feb 2001 23:15:07 +0100 (MET) 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 SAA26357 for ; Wed, 14 Feb 2001 18:22:18 +0100 (MET) Received: from relay.wplus.net (relay.wplus.net [195.131.52.179]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f1EHMHb11531 for ; Wed, 14 Feb 2001 18:22:17 +0100 (MET) X-Real-To: caml-list@inria.fr Received: from kouzdra.glokaya (ip84-61.dialup.wplus.net [195.131.84.61]) by relay.wplus.net (8.9.1/8.9.1/wplus.2) with ESMTP id UAA87922; Wed, 14 Feb 2001 20:22:01 +0300 (MSK) Received: from localhost (msk@localhost) by kouzdra.glokaya (8.9.3/8.9.3) with ESMTP id UAA12279; Wed, 14 Feb 2001 20:24:30 +0300 X-Authentication-Warning: kouzdra.glokaya: msk owned process doing -bs Date: Wed, 14 Feb 2001 20:24:30 +0300 (MSK) From: Anton Moscal X-Sender: msk@kouzdra.glokaya To: Don Syme cc: caml-list@inria.fr Subject: [Caml-list] RE: OCaml on CLR/JVM? In-Reply-To: <0C682B70CE37BC4EADED9D375809768A48FD31@red-msg-04.redmond.corp.microsoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 9 Feb 2001, Don Syme wrote: > Java/.NET component building seriously right from the start I feel you're > always just going to end up with a bit of a hack - an interesting, usable > hack perhaps, but not a really _good_ language. > > Probably the greatest recurring technical problem that I see in this kind of > work is that of type inference, and the way both the Java and .NET models > rely on both subtyping and overloading to help make APIs palatable. Type > inference just doesn't work well with either subtyping or oveloading. This > is a great, great shame, as it's obviously one of the main things ML has to > offer to improve productivity. I think, subtyping probably isn't serious problem: O'Caml already have subtyping relations (between objects and also between variant types). And only problem arisen is necessity of the explicit type specification in some constructions. O'Caml haven't overloading, but probably overloading can be implemented in the same way as subtyping: by requirement of the explicit type specifications in case of ambiguities (SML have some builtin overloaded operators and resolve emerging problems in this way). I think, there is more serious problem: O'Caml have structural subtyping relation between objects, whereas .NET type system have subtyping relation based on explicitly declared inheritance: ---------------------- class point1 (x:int) = object method x = x end class point2 (x:float) (y:float) = object method x = x method y = y end let get_x p = p#x let _ = Printf.printf "%d\n" (get_x (new point1 1)) let _ = Printf.printf "%g\n" (get_x (new point2 10.0 20.0)) ---------------------- function get_x has type -> 'a and can works with the any object, which have method "x". I see no ways to map this into .NET framework except using reflection (which is overkill). Also, point2 is subtype of point1, but there isn't explicit inheritance declaration here. Moreover point1 and point2 can be defined in independent modules and don't know each other. Anton ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr