From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id ABDE6BC88 for ; Sat, 5 Feb 2005 20:26:39 +0100 (CET) Received: from first.in-berlin.de (dialin-145-254-052-069.arcor-ip.net [145.254.52.69]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j15JQcWZ008760 for ; Sat, 5 Feb 2005 20:26:38 +0100 Received: by first.in-berlin.de (Postfix, from userid 501) id B1F12A8064; Sat, 5 Feb 2005 20:26:39 +0100 (CET) Date: Sat, 5 Feb 2005 20:26:39 +0100 From: Oliver Bandel To: caml-list@yquem.inria.fr Subject: Re: Why can't types and exceptions be nested (was: Re: [Caml-list] Estimating the size of the ocaml community) Message-ID: <20050205192639.GC328@first.in-berlin.de> References: <000f01c50971$baad4840$0100a8c0@mshome.net> <1107403128.32586.223.camel@pelican.wigram> <20050203173556.4acec1c5.ocaml-erikd@mega-nerd.com> <009a01c50a1e$f6c92080$0100a8c0@mshome.net> <20050204103006.GA498@first.in-berlin.de> <20050205131418.GC484@first.in-berlin.de> <20050205163732.GA13169@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050205163732.GA13169@furbychan.cocan.org> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 42051DEE.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; oliver:01 bandel:01 oliver:01 in-berlin:01 caml-list:01 ocaml:01 wrote:01 bandel:01 wrote:01 ocaml:01 compiler:01 ...:98 ....:98 exception:01 integer:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: 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. Ciao, Oliver