Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Unix.kill on Win32
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: Re: [Caml-list] static class member....
I think that my issue with the class system is that IMO it doesn't quite fit 
well with the rest of the language, as a class shares some properties with 
modules, and some with records, and has a few of it's own, but doesn't permit 
pattern matching syntax. 

With a few extensions to records (a new kind of records, dual to polymorphic 
variants as sum types are to records), modules (first class modules?, mixin 
modules?), and core ML (yes, I'm still rooting for G'Caml extensions :) that 
even OOP fans would find it classy sans class. 

Even without those extensions, I find the core language + modules sufficient to 
do almost everything nicely, but my pre "ML epiphany" tastes ran towards 
Modula-2/3 and Ada 95 rather than C++ so I may just be warped...

-- Brian

On Wed, 6 Aug 2003, james woodyatt wrote:

> [please reply to]
> On Wednesday, Aug 6, 2003, at 09:12 US/Pacific, on the main Ocaml 
> mailing list, 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 Archives:
> Bug reports: FAQ:
> Beginner's list:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: