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
[OSR] Exceptionless error management, take 2
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-08 (20:01)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] [OSR] Exceptionless error management, take 2
On Friday 08 February 2008 09:53:33 Vincent Hanquez wrote:
> so what's the point in using polymorphics variant then ?


  | Xml.Error.Succeed x -> f x
  | Xml.Error.Failure y -> g y


  | `Succeed x -> f x
  | `Failure y -> g y

The alternative is to open the namespace that contains the ordinary variant, 
which pollutes your namespace will all of its identifiers.

> > And they _cannot_ pollute any namespace, since they define nothing.
> did you actually read my previous reply ?
> they "pollute" since the polymorphic variant namespace is flat, and
> don't interact with module (on purpose obviously)

As Jacques said, polymorphic variants don't define anything, i.e. don't bind 
identifiers to type constructors. So they can't pollute anything. The "flat 
namespace" you refer to doesn't exist.

This is the same as strings. You would not discourage the use of "foo" in 
programs because it "pollutes the flat namespace of strings" for the same 

Dr Jon D Harrop, Flying Frog Consultancy Ltd.