From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 EF0C5BDD1 for ; Wed, 24 Aug 2005 22:56:24 +0200 (CEST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7OKuOEI004653 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 24 Aug 2005 22:56:24 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay01.plus.net with esmtp (Exim) id 1E82ID-0005NZ-VS for caml-list@yquem.inria.fr; Wed, 24 Aug 2005 21:56:18 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Parameter evaluation order Date: Wed, 24 Aug 2005 21:53:37 +0100 User-Agent: KMail/1.7.2 References: <43065B83.6050503@dravanet.hu> <430CD307.8000802@univ-savoie.fr> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508242153.37933.jon@ffconsultancy.com> X-Miltered: at concorde with ID 430CDEF8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 constructors:01 sml:01 iirc:01 polymophic:01 variants:01 constructors:01 curried:01 syntax:01 infix:01 ocaml:01 25,:98 ...:98 frog:98 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Wednesday 24 August 2005 21:25, brogoff wrote: > > I would prefer square bracket for constructor application, mandatory > > even for unary constructor (and maybe also constant constructor then you > > can lift the restriction about capital letter) It would be nice if variant constructors were functions (as they are in SML, IIRC). So you could do this: # type num = Int of int | Float of float;; type num = Int of int | Float of float # List.map Int [1; 2; 3];; - : num list = [Int 1; Int 2; Int 3] Rather than having to do "List.map (fun i -> Int i) ...". That wouldn't work with polymophic variants though, at least not trivially. If variant constructors always accepted a single, tuple argument could it not be optimised away in most cases? Also, could constructors be curried instead of using tuples (or syntax that looks like tuples)? > The examples that bother me most are record constructors, where I want to > read structured data from a file into a record. And of course :: (which is > just sugar) too. Yes. It would be nice if (fun h t -> h::t) could be written infix as ( :: ), as operators are. In fact, couldn't that be added without breaking backward compatibility? > It's a fun topic to chat about, but if you were allowed one change in the > language, surely this wouldn't be it? :-) Good question. :-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists