Re: What will the new syntax be like? (O'Caml + O'Labl)

From: Jacques Garrigue (Jacques.Garrigue@inria.fr)
Date: Mon Dec 06 1999 - 12:05:45 MET


To: prevost@maya.com
Subject: Re: What will the new syntax be like? (O'Caml + O'Labl)
In-Reply-To: Your message of "05 Dec 1999 22:05:20 -0500"
        <87wvqskbv3.fsf@isil.maya.com>
Message-Id: <19991206120545J.garrigue@pauillac.inria.fr>
Date: Mon, 06 Dec 1999 12:05:45 +0100
From: Jacques Garrigue <Jacques.Garrigue@inria.fr>

From: John Prevost <prevost@maya.com>

> 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

Changes are rather small:

let foo bar:a zub:b ?qux:c{=10} ?woz:d () =
  match d with
  | None -> a + b + c
  | Some x -> a + b + c + d

Notice that you need a non-labeled argument after optional ones, due
to a change in semantics. Optional arguments are now only discarded if
the function is applied to a non-labeled argument appearing after them
the function type.
This change was necessary to resolve some ambiguities, and provide an
untyped semantics for the language.

> Things which freak me out:
> [...]

You may like or not the above notation for labels. We had discussions
here, and the conclusion was that putting spaces around type
annotations was a good thing anyway...

I will not answer in detail your other comments, but yes, the change
in notation for default arguments is to avoid the similarity with
stream parsers.

Variant types have also a cleaned-up syntax, where recursion works
like with objects.

> 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.

It's hard to put that many new features in the language, keeping the
compatibility with all, and obtain a clean syntax. I must admit.
However I think that ocaml3 syntax is reasonable enough, at least
better than olabl's. A second attempt has its advantages.

By the way, the new version is not yet released, so if you have a
coherent syntax to propose for the new features, you can propose.

        Jacques
------------------------------------------------------
Jacques Garrigue, visiting INRIA from Kyoto University
                          Jacques.Garrigue at inria.fr



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET