From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id AEBE6BB91 for ; Sat, 23 Jul 2005 18:37:21 +0200 (CEST) Received: from 26.mail-out.ovh.net (26.mail-out.ovh.net [213.186.42.179]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6NGbL2L004714 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 23 Jul 2005 18:37:21 +0200 Received: (qmail 9941 invoked by uid 503); 23 Jul 2005 16:37:23 -0000 Received: (QMFILT: 1.0); 23 Jul 2005 16:37:23 -0000 Received: from b6.ovh.net (HELO mail155.ha.ovh.net) (213.186.33.56) by 26.mail-out.ovh.net with DES-CBC3-SHA encrypted SMTP; 23 Jul 2005 16:37:23 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 23 Jul 2005 16:37:24 -0000 Received: from mail155.ha.ovh.net (10.0.50.155) by mail155.ha.ovh.net with SMTP; 23 Jul 2005 16:37:21 -0000 Received: from b0.ovh.net (HELO queue-pre) (213.186.33.50) by b0.ovh.net with SMTP; 23 Jul 2005 16:37:21 -0000 Received: from ppp-69-228-157-203.dsl.scrm01.pacbell.net (HELO trantor.glondu.net) (postmaster%glondu.net@69.228.157.203) by ns0.ovh.net with SMTP; 23 Jul 2005 16:37:21 -0000 From: Stephane Glondu To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] How to do this properly with OCaml? Date: Sat, 23 Jul 2005 09:36:47 -0700 User-Agent: KMail/1.7.1 Cc: Berke Durak References: <42E2393B.5030209@inria.fr> <20050723131626.GB11661@ara.zapto.org> In-Reply-To: <20050723131626.GB11661@ara.zapto.org> Organization: Crans MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507230936.47352.Stephane.Glondu@crans.org> X-Ovh-Remote: 69.228.157.203 (ppp-69-228-157-203.dsl.scrm01.pacbell.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Miltered: at nez-perce with ID 42E27241.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 berke:01 durak:01 unspecified:01 recursive:01 mutable:01 mutable:01 rec:01 ...:98 wrote:01 hacks:01 functions:01 define:01 tuples:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.9 required=5.0 tests=FORGED_RCVD_HELO, RCVD_IN_BL_SPAMCOP_NET autolearn=disabled version=3.0.3 On Saturday 23 July 2005 06:16, Berke Durak wrote: > However I was wondering how feasible it would be to have a "any : 'a" > value, that would return an (unspecified) value of any given type... That seems to be dirty and would surely beak type safety. > This is clearly feasible for base types. > possible for tuples, records and functions of base types. What do you mean? > Recursive values could prove problematic : > > type stuff1 = { mutable a : stuff2 } > and stuff2 = { mutable b : stuff1 } What's the problem here? You can always define a dummy value of a given type: let rec dummy1 = { a = dummy2 } and dummy2 = { b = dummy1 } > Would it be worth the fuss ? I think that a better design (which doesn't need such hacks) would be worth. Stephane Glondu.