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
[Caml-list] labels and optional arguments in 3.06
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-11-14 (03:35)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] labels and optional arguments in 3.06
From: Chris Hecker <>
> >val f : ~a:float -> ?a:float -> float -> float
> Why would this even be legal?  Is there some reason to allow multiple 
> labels with the same name?

There is a good reason to have it legal: there is no way to make it

Suppose you have a polymorphic function:
val g : f:'a -> a:int -> 'a
# g ~f:(fun ~a -> not a);;
- : a:int -> a:bool -> bool

As long as we use normal type variables for function results, we must
allow it.

> Is there a problem with the behavior I want without duplicate labels?

Indeed, that would leave no ambiguity. So it might be ok to allow
mixing labelled optional arguments in an otherwise unlabelled
application, if there is no ambiguity on labels. But is it really
worth a strange definition, when the workaround is just to add

Jacques Garrigue
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: