<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/749c12c565ddbf0ae14c53f7880c11dc"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-07-28T16:35:21"
  subject="Re: [Caml-list] naming parts of optional arguments?"
  prev="2003/07/c546c6fd40c929e9dafaa1c48b5a9e7e"
  next="2003/07/01ec52a086a48ba9f37cf34e09d2a702"
  prev-in-thread="2003/07/b4454db83baee6171cc89bb50c35748f"
  next-in-thread="2003/07/81a0bd462ef07ae6386a9582e266680a"
  prev-thread="2003/03/386b601bed4a77644727a870ecb9b650"
  next-thread="2003/03/1093f82a8413923ed0b56594e9cc3f1f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/03/119f206668e58a6a506aaca149c5b9cd"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-03-28T01:09:51"
  subject="[Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/03/f3bf978bb3304d9c9091a49a5a30fe8f"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-03-28T01:14:42"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/03/14613e93c23bda4f4329db2dbc87593e"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-03-28T02:15:45"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/07/813bceb9981111a4ecb3a4e5773de997"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-07-28T03:43:13"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/07/b4454db83baee6171cc89bb50c35748f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-28T07:19:00"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/07/749c12c565ddbf0ae14c53f7880c11dc"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-07-28T16:35:21"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/07/81a0bd462ef07ae6386a9582e266680a"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-07-29T03:20:02"
  subject="Re: [Caml-list] naming parts of optional arguments?">
<msg 
  url="2003/07/3f3ced666b2a7750ac278ca971c5f0bc"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-07-29T21:52:34"
  subject="Re: [Caml-list] naming parts of optional arguments?">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/03/1cfe6461b4857eaa0ae5dc27581fe317"
  from="Max Kirillov &lt;max630@m...&gt;"
  author="Max Kirillov"
  date="2003-03-28T01:46:05"
  subject="Re: [Caml-list] naming parts of optional arguments?">
</msg>
</msg>
</thread>

<contents>

&gt;No contradiction at all: ?xy: is a label, not a variable name.

Well, except for in this case, of course, when it is a variable name:

# let f ?xy () = xy;;
val f : ?xy:'a -&gt; unit -&gt; 'a option = &lt;fun&gt;

&gt;If you care about length, you can still write:
&gt;   let f ?(xy=(0,0)) () = xy

No, because I need to break out the parts of the tuple and name the whole 
tuple, which was the point of the thread, so the only way to do that I can 
see is this beautiful expression:

# let f ?xy:((x,y) as xy = 0,0) () = xy,x,y;;
val f : ?xy:int * int -&gt; unit -&gt; (int * int) * int * int = &lt;fun&gt;

All I'm saying is that having the first example above work leads one to 
believe the xy is usable inside the function body in general.

On the whole, the syntax for defining default parameters is nonintuitive 
and inconsistent, because you need the parenthesis sometimes, you need the 
"as xy" sometimes, you need the ?label: sometimes, etc.

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

</contents>

</message>

