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
Estimating the size of the ocaml community
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-05 (19:26)
From: Oliver Bandel <oliver@f...>
Subject: Re: Why can't types and exceptions be nested (was: Re: [Caml-list] Estimating the size of the ocaml community)
On Sat, Feb 05, 2005 at 04:37:32PM +0000, Richard Jones wrote:
> On Sat, Feb 05, 2005 at 02:14:18PM +0100, Oliver Bandel wrote:
> > ...well....
> > 
> > type sometimes_t = Integer of int | One_symbol | Another_symbol
> Another annoyance of OCaml is that 'type' definitions (and exception
> defns for that matter) can't be nested.  I'm a big big fan of nested
> functions, and sometimes I want to return a type which is only used
> briefly between two nested functions.  Instead the type has to go
> right at the start of the outer function, which may be many pages of
> code away.  This reduces readability.

What does "nested types" mean?

Can you explain, what this is?

How would a nested OCaml-type looks like,
if the compiler would allow it?

Example please.