Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: Syntax for label
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-03-18 (18:00)
From: Christophe Raffalli <Christophe.Raffalli@u...>
Subject: Re: Syntax for label, NEW SOLUTION

First to clarify, there are two distinct problems with labels:

- Their syntax: Anything that let me put (or not put) spaces where I
want will suit me. (If people are not happy with the final syntax let
them use camlp4 :-)

- Their semantics in modern mode.

I quite agree, their should not be two modes, because this will means
two communities of users and therefore at some point two standards
libraries because each kind of users will have different needs. This is
dangerous ...
soon there would not be only one big caml community anymore.

But there may be a solution in three step:

1) Let's have only the modern mode. But let it accept any expressions
with no amibiguities. This means that if according to both types AND
labels there is a unique valid order of arguments then the compiler do
not complain.

At this point you can use blit with

> Array.blit a src_pos:x b dst_pos:y len

If both array a and b have not the same types and

> Array.blit src:a src_pos:x b dst_pos:y len

If they have the same type.

This is reasonnable ! 

But can this be implemented ? I think that this is what people wants for
labels (at least what I want). And if this is not implementable at this
time let's wait for a solution ! 

2) let's turn error messages about labels ambiguities into warning and
-modern option into an option to print or not these warnings. This is
more reasonnable and conform to the usage in a lot of programming

3) For the problem of List.fold_left (+), there is a solution: tell to
the compiler that (+) is commutative ! Or more generally find a syntax
to tell that two or more arguments of the same types may be commuted
without changing the behaviour of the function. Then there would be no
ambiguities when you type List.fold_left (+) and the compiler wii not
complain ! There would be a problem only with  List.fold_left (/) but
then writing the labels explicitely may be better (or rewrite it with a


Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42