Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: John Whitley <whitley@cse.buffalo.edu>
To: caml-list@inria.fr
Subject: OLabl optional arguments and higher order functions
Date: Thu, 18 Mar 1999 01:35:40 -0500 (EST)	[thread overview]
Message-ID: <14064.39685.480989.489383@hadar.cse.Buffalo.EDU> (raw)


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




             reply	other threads:[~1999-03-18  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-18  6:35 John Whitley [this message]
1999-03-24  1:38 ` Jacques GARRIGUE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14064.39685.480989.489383@hadar.cse.Buffalo.EDU \
    --to=whitley@cse.buffalo.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox