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-10 (16:51)
From: Matthew William Cox <matt@m...>
Subject: Re: [Caml-list] [OSR] Exceptionless error management, take 2
On Fri, Feb 08, 2008 at 07:07:58PM +0000, Jon Harrop wrote:
> 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.

They do exist in a flat namespace, just not a namespace that resides in
the compiler's abstractions. They do live in the programmer's *mind*,
and there it is crucial to keep things unpolluted. The compiler will
always (modulo bugs) keep things perfectly straight and not confuse
itself. Humans will. (Programming) languages are designed to convey
machine instructions meaningfully to humans, so befuddling the poor
human is working against what the language is there do.

As has been pointed out, `Error 1 could have totally different semantic
meanings in a module for parsing XML, and a module for POSIX functions.

No namespace has been `polluted' since `Error is still available for me
to use. That's not the pollution I'm concerned about. The pollution I
care about is the semantic overlap that *I* have to deal with.

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

Sure, values can't pollute anything, just like using a lot of 5's
doesn't pollute the integer namespace. On the other hand, raising
Failure "foo" in 50 different functions for as many different reasons
would be semantic pollution.