<?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/10/801b7b1b1823b88569425a89ac8c7458"
  from="Andreas Rossberg &lt;rossberg@p...&gt;"
  author="Andreas Rossberg"
  date="2003-10-08T16:49:13"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors"
  prev="2003/10/897ac973c627b803ed112c8001b114a4"
  next="2003/10/381db41c1fe9cbbdbe0afbb6f271d21e"
  prev-in-thread="2003/10/fe9eb2aaab78d81d8a7bbe3b3ba36dc7"
  next-in-thread="2003/10/381db41c1fe9cbbdbe0afbb6f271d21e"
  prev-thread="2003/10/e79513aa34d4347fb9f61c4d83c4e732"
  next-thread="2003/10/d04befa7beb24ef22b9d02a9066de8f7"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/8e30e035c3408ed133428b3777754c4d"
  from="Serge &lt;serge@s...&gt;"
  author="Serge"
  date="2003-10-08T15:57:09"
  subject="[Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/fe9eb2aaab78d81d8a7bbe3b3ba36dc7"
  from="Dan Grossman &lt;djg@c...&gt;"
  author="Dan Grossman"
  date="2003-10-08T16:07:33"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/801b7b1b1823b88569425a89ac8c7458"
  from="Andreas Rossberg &lt;rossberg@p...&gt;"
  author="Andreas Rossberg"
  date="2003-10-08T16:49:13"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/381db41c1fe9cbbdbe0afbb6f271d21e"
  from="Dan Grossman &lt;djg@c...&gt;"
  author="Dan Grossman"
  date="2003-10-08T17:04:56"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/7e91616dcacffc47b139c28c440aa9e3"
  from="Andreas Rossberg &lt;rossberg@p...&gt;"
  author="Andreas Rossberg"
  date="2003-10-09T12:44:06"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
</msg>
</msg>
<msg 
  url="2003/10/7778131e9bb9dc8f0e37e810e13cd361"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-10-08T18:28:21"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
<msg 
  url="2003/10/bfa15ffef4ce902d4ae1ce0139df5072"
  from="Marcin &apos;Qrczak&apos; Kowalczyk &lt;qrczak@k...&gt;"
  author="Marcin &apos;Qrczak&apos; Kowalczyk"
  date="2003-10-08T18:44:22"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/10/ee34acd3dffbe03f80f49fb59152a170"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-08T16:15:10"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
</msg>
<msg 
  url="2003/10/897ac973c627b803ed112c8001b114a4"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-10-08T16:25:26"
  subject="Re: [Caml-list] Constructors as functions and tuples in constructors">
</msg>
</msg>
</thread>

<contents>
Dan Grossman wrote:
&gt; 
&gt;&gt; Second, it would also be nice not to have "the concept of constructor
&gt;&gt; arity", and treat the code below as correct:
&gt;&gt;
&gt;&gt; type t = A of int * int
&gt;&gt; let _ =   match A (17, 0) with
&gt;&gt;     A z -&gt; match z with (x, y) -&gt; ()
&gt; 
&gt; Works with type t = A of (int * int).  You put the parens in.  So the 
&gt; choice is yours.  The advantage of leaving them out is usually performance.

That is not true. It would be quite trivial for the compiler to translate

   A z -&gt; e

into the equivalent of

   A(z1,z2) -&gt; let z = (z1,z2) in e

without affecting performance of other programs in any way. Likewise,

   A z

could be transformed into

   let (z1,z2) = z in A(z1,z2)

instead of rejecting it. OTOH, your workaround certainly decreases 
performance for type t, as other pointed out.

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

"Computer games don't affect kids; I mean if Pac Man affected us
  as kids, we would all be running around in darkened rooms, munching
  magic pills, and listening to repetitive electronic music."
  - Kristian Wilson, Nintendo Inc.

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

