Version française
Home     About     Download     Resources     Contact us    
Browse thread
OLabl optional arguments and higher order functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Whitley <whitley@c...>
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