Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] naming parts of optional arguments?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] naming parts of optional arguments?

Before someone comments that the optional argument is an 'a option and not 
an 'a, what I really wanted to do is this:

# let f ?(((x,y) as xy) = 0.0,0.0) () = xy;;
Characters 8-9:
   let f ?(((x,y) as xy) = 0.0,0.0) () = xy;;
           ^
Syntax error

Which also doesn't work but there's no 'a option involved, so it 
"should".  I was trying to create the shortest example but took it a bit 
too far.

Chris

At 17:05 3/27/2003 -0800, Chris Hecker wrote:

>Is there a way to name the components of an optional argument?
>
># let f ((x,y) as xy) = xy;;
>val f : 'a * 'b -> 'a * 'b = <fun>
># let f ?xy () = xy;;
>val f : ?xy:'a -> unit -> 'a option = <fun>
># let f ?((x,y) as xy) () = xy;;
>Characters 8-9:
>   let f ?((x,y) as xy) () = xy;;
>           ^
>Syntax error
>
>Chris
>
>-------------------
>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

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