<?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/11/f231a8cd9ca4701405a6a6e5f6f9b309"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-07T22:35:40"
  subject="Re: [Caml-list] labels in records?"
  prev="2003/11/394f41f69a257eeacde18d22bf8fce94"
  next="2003/11/abff800f267cf8fbd094693a8b321bf2"
  prev-in-thread="2003/11/394f41f69a257eeacde18d22bf8fce94"
  prev-thread="2003/11/da696d358ae593a66f88c4f96053e5dc"
  next-thread="2003/11/91026f5c9a6c85960c1b03109f47fd47"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] labels in records?">
<msg 
  url="2003/11/394f41f69a257eeacde18d22bf8fce94"
  from="Chris GauthierDickey &lt;chrisg@c...&gt;"
  author="Chris GauthierDickey"
  date="2003-11-07T22:27:11"
  subject="[Caml-list] labels in records?">
<msg 
  url="2003/11/f231a8cd9ca4701405a6a6e5f6f9b309"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-07T22:35:40"
  subject="Re: [Caml-list] labels in records?">
</msg>
</msg>
</thread>

<contents>
On Fri, 7 Nov 2003, Chris GauthierDickey wrote:

&gt; Is it possible to use a labelled function as a member of a record?
&gt; 
&gt; In other words:
&gt; 
&gt; let f ~x = x + 1
&gt; 
&gt; type { g: ~x:int -&gt; int }
&gt;                ^
&gt;          syntax error

No tilde.  Try:
type t = { g: x:int -&gt; int }

One nice thing about ocaml, is that the top level prints out 
syntax-correct types.  So, you see: 

# let f ~x = x + 3 ;;
val f : x:int -&gt; int = &lt;fun&gt;
#

Note that lack of a tilde on the type definition.  I just mention this 
because it's how *I* remember when a tilde is needed and when it isn't 
:-).

Brian


-------------------
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>

