Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
weirder.

http://caml.inria.fr/archives/200211/msg00176.html
discusses this a bit, but I'm not quite sure I understand it.  :\

-- 
Evan Martin
martine@danga.com
http://neugierig.org

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners