From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA27856 for caml-redistribution; Mon, 6 Dec 1999 08:55:15 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA04852 for ; Mon, 6 Dec 1999 04:13:27 +0100 (MET) Received: from isil.maya.com (HOPKINS.PC.CS.CMU.EDU [128.2.215.35]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id EAA20684 for ; Mon, 6 Dec 1999 04:13:24 +0100 (MET) Received: (from prevost@localhost) by isil.maya.com (8.9.3/8.9.3) id WAA06954; Sun, 5 Dec 1999 22:05:20 -0500 X-Authentication-Warning: isil.maya.com: prevost set sender to prevost@maya.com using -f Sender: weis To: caml-list@inria.fr Subject: What will the new syntax be like? (O'Caml + O'Labl) From: John Prevost Date: 05 Dec 1999 22:05:20 -0500 Message-ID: <87wvqskbv3.fsf@isil.maya.com> User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Can we get any hints on what the syntax of the O'Labl features in the new O'Caml will be like? I do like the polymorphic variants and tagged/optional argument features of O'Labl, but I'm not too keen on their syntax: let foo bar:a zub:b ?qux:c [< 10 >] ?woz:d = match d with | None -> a + b + c | Some x -> a + b + c + d Things which freak me out: a) the ident1:ident2 syntax for labels is maybe convenient, but the fact that : is already used for types and that this requires : to not have whitespace around it is pretty nasty. b) the ?... syntax for optional stuff is pretty abominable. Combined with the : syntax, the definition of a function starts to look like gibberish. c) the ?... [< ... >] syntax for providing a default value for an optional argument adds to the pain, since [< ... >] is already used by parsers, and its heaviness combined with the ?s lightness makes it really obscure what a line like the above means. d) not illustrated above, the use of ` for polymorphic variants is also pretty ferociously confusing--mainly because ` and ' are sometimes difficult to tell apart, and because I could now say something like: let foo = parser [< '`foo 'a' >] -> ... which is parsable, but nasty. e) The type expressions that come out are sometimes nasty looking as well: 'a[> 'int int | 'float float] which is actually not that bad, except for the 'a part which is quite unlike other self-referential types in O'Caml. (Why not something like objects: [> 'int int | 'float float ] as 'a?) I just sucked down the O'Caml CVS version and have played with it a bit trying to figure out what syntax is in the works. As far as I can tell, the : is still being overloaded as above, and ? is being used too, but [< ... >] has been changed (to something like {= ...} ? I can't entirely tell, because if I try to use it I always get a "This optional argument cannot be erased" warning. Anyway, what's in store for us in the next version of O'Caml? I've thought Caml's syntax the cleanest of the ML family for some time, but warts like the above could make me change my mind. John