From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL,SPF_PASS autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 15A58BC6B for ; Sat, 28 Jul 2007 20:53:43 +0200 (CEST) Received: from kraid.nerim.net (smtp-106-saturday.nerim.net [62.4.16.106]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6SIrgFe027966 for ; Sat, 28 Jul 2007 20:53:42 +0200 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by kraid.nerim.net (Postfix) with ESMTP id 2D0D3CF0C8; Sat, 28 Jul 2007 20:53:42 +0200 (CEST) Received: from [192.168.0.1] (glinka.lesours [192.168.0.1]) by hector.lesours (Postfix) with ESMTP id D000320F236; Sat, 28 Jul 2007 20:53:40 +0200 (CEST) Message-ID: <46AB9099.6030700@starynkevitch.net> Date: Sat, 28 Jul 2007 20:53:13 +0200 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070621) MIME-Version: 1.0 To: Stefan Monnier Cc: Chris King , caml-list@inria.fr Subject: Re: [Caml-list] Void type? References: <875c7e070707272151v2dc46c2ap3f7ed4ebd005726e@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46AB90B6.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; basile:01 basile:01 ocaml:01 simulate:01 o'caml:01 faiencerie:01 92340:01 reine:01 wrote:01 abstract:01 caml-list:01 8501:02 2359:02 declaring:02 unit:03 Stefan Monnier wrote: >>> Is there a void type in OCaml (i.e. a type which has no values), or a way to >>> simulate it? > >> If you're looking for a "true" void (as opposed to the unit type, >> which has exactly one value), just declaring it as an abstract type: > >> type void > >> should do the trick. You will be unable to instantiate any values of >> that type using pure O'Caml (i.e. no Obj.magic or C code). > > But can I pass [] to a function that expects a "void list"? Yes. It is the only list of type void list. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet | mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***