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
Duplicate functionality?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Duplicate functionality?
On Saturday 22 October 2005 02:04, Stephen Brackin wrote:
> My biggest initial question is why OCaml has both a modules system and
> objects: Aren't they different ways of accomplishing the same things?

Both modules and objects allow you to encapsulate related definitions, yes.

However, modules are much more static by nature and objects are much more 
dynamic, i.e. you get stronger static checking using modules than you do 
using objects, giving more comprehensible error messages and more robust and 
faster code.

Consequently, OCaml programmers tend to prefer modules over objects where 

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists