caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Prevost <prevost@maya.com>
To: caml-list@inria.fr
Subject: What will the new syntax be like? (O'Caml + O'Labl)
Date: 05 Dec 1999 22:05:20 -0500	[thread overview]
Message-ID: <87wvqskbv3.fsf@isil.maya.com> (raw)

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




             reply	other threads:[~1999-12-06  7:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-06  3:05 John Prevost [this message]
1999-12-06 11:05 ` Jacques Garrigue
1999-12-07  7:35   ` John Prevost
1999-12-07 15:36 Don Syme
1999-12-07 18:21 ` Markus Mottl
1999-12-07 18:32 ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wvqskbv3.fsf@isil.maya.com \
    --to=prevost@maya.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).