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] Total application of function with labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-05 (23:16)
From: Evan Martin <martine@d...>
Subject: Re: [Caml-list] Total application of function with labels
On Wed, May 05, 2004 at 05:18:22PM -0400, Manos Renieris wrote:
> Is there a programming convention that would "enforce" labeling the 
> arguments in a total application of a certain function? 

# type withlabels = WithLabels;;
type withlabels = WithLabels
# let withlabels = WithLabels;; 
val withlabels : withlabels = WithLabels

# let f ~a ~b ?(withlabels : withlabels option) = a + b;;
Warning: This optional argument cannot be erased
val f : a:int -> b:int -> ?withlabels:withlabels -> int = <fun>
# f 2 3 ~withlabels;;
Expecting function has type a:int -> b:int -> int
This argument cannot be applied without label

This includes the ... includes the "optional argument cannot be erased
warning", which can be avoided at the cost of making the code even
discusses this a bit, but I'm not quite sure I understand it.  :\

Evan Martin

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