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.1 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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 02A02BC6B for ; Sat, 28 Jul 2007 10:13:23 +0200 (CEST) Received: from mallaury.nerim.net (smtp-106-saturday.noc.nerim.net [62.4.17.106]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6S8DN0p000796 for ; Sat, 28 Jul 2007 10:13:23 +0200 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by mallaury.nerim.net (Postfix) with ESMTP id 06AD84F3DD for ; Sat, 28 Jul 2007 10:13:18 +0200 (CEST) Received: from [192.168.0.1] (glinka.lesours [192.168.0.1]) by hector.lesours (Postfix) with ESMTP id 6FE8B20F236 for ; Sat, 28 Jul 2007 10:13:17 +0200 (CEST) Message-ID: <46AAFA8F.1000501@starynkevitch.net> Date: Sat, 28 Jul 2007 10:13:03 +0200 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070621) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Void type? References: <20070728075825.GA3508@galois> In-Reply-To: <20070728075825.GA3508@galois> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 46AAFAA3.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; basile:01 basile:01 ocaml:01 simulate:01 ocaml:01 afaik:01 faiencerie:01 92340:01 reine:01 wrote:01 rec:01 exception:01 caml-list:01 functions:01 functions:01 S=E9bastien Hinderer wrote: > Stefan Monnier : >> Is there a void type in OCaml (i.e. a type which has no values), or a = way to >> simulate it? >=20 > What about > type void =3D { v : void };; You can build such a value with let rec vv =3D { v =3D vv };; Generally speaking, the unit type whose single value is () is used in Oca= ml for what C calls the void type: unit=20 returning functions are procedures. A void type would be useful for bizarre functions like f : int -> void this would mean that f never returns normally, i.e. that it loops indefin= itely, or calls exit (to stop the entire program), or throws an exception but never= returns. AFAIK, there is no such void type in Ocaml (but some members of Gallium d= id publish papers mentioning void). However, there is one thing I did not understand: why (=3D what for) does= Stefan Monnier want a void type? --=20 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} ***