Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: OCaml on CLR/JVM?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] RE: OCaml on CLR/JVM?
Anton Moscal wrote:
> 
> 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).


> 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 <x: 'a; ..> -> '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.

	The converse problem is to reflect the C++ signature matching
in Ocaml, which may be required to access C++ libraries. 

	1. 'Const' is probably impossible to model in the Ocaml type system,
		(does .NET support that?)
	2. multiple inheritance may be possible with polymorphic variants
		(?)

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr