OLabl optional arguments and higher order functions

From: John Whitley (whitley@cse.buffalo.edu)
Date: Thu Mar 18 1999 - 07:35:40 MET


From: John Whitley <whitley@cse.buffalo.edu>
Date: Thu, 18 Mar 1999 01:35:40 -0500 (EST)
To: caml-list@inria.fr
Subject: OLabl optional arguments and higher order functions

Consider the following example, from OLabl 2.02:

# let ack ?:x [< 0 >] :y = x * y;;
val ack : ?x:int -> y:int -> int = <fun>
# let hack funarg = funarg x:4 y:5;;
val hack : (x:int -> y:int -> 'a) -> 'a = <fun>
# hack ack;;
Characters 5-8:
This expression has type ?x:int -> y:int -> int but is here used with
type
  x:int -> y:int -> 'a

This seems like a bug. Intuitively, labels x: and ?x: should unify.
If not, I would appreciate a brief explanation as to why not...

Forcibly replacing the optional argument with the same label via fun
works just fine:

# hack (fun :x -> ack :x);;
- : int = 20

Thanks for any insights,
John



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:21 MET