Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 ?

Brevity:

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

vs:

  | `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 
reason.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e