Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* OLabl optional arguments and higher order functions
@ 1999-03-18  6:35 John Whitley
  1999-03-24  1:38 ` Jacques GARRIGUE
  0 siblings, 1 reply; 2+ messages in thread
From: John Whitley @ 1999-03-18  6:35 UTC (permalink / raw)
  To: caml-list


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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-03-24 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-18  6:35 OLabl optional arguments and higher order functions John Whitley
1999-03-24  1:38 ` Jacques GARRIGUE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox