<?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="2009/10/0328a8af6bfbcd9e0150e7be86ab0338"
  from="David Allsopp &lt;dra-news@m...&gt;"
  author="David Allsopp"
  date="2009-10-09T15:28:08"
  subject="RE: [Caml-list] Improving OCaml&apos;s choice of type to display"
  prev="2009/10/df4a6df06a68d7b65fc88ce7b1fe0289"
  next="2009/10/7c6d3ad6bfb93955eefdc3f0a47a181a"
  prev-in-thread="2009/10/df4a6df06a68d7b65fc88ce7b1fe0289"
  next-in-thread="2009/10/7c6d3ad6bfb93955eefdc3f0a47a181a"
  prev-thread="2009/10/1b087dcc1f0f6132c02c68dbbb67bc95"
  next-thread="2009/10/2a3b947aa9b77f6b0e4558b8fd0b4984"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/0880e1b35fd2d07cead92a1871df73b7"
  from="Damien Guichard &lt;alphablock@o...&gt;"
  author="Damien Guichard"
  date="2009-10-09T14:18:47"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/df4a6df06a68d7b65fc88ce7b1fe0289"
  from="Vincent Aravantinos &lt;vincent.aravantinos@g...&gt;"
  author="Vincent Aravantinos"
  date="2009-10-09T14:45:08"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/0328a8af6bfbcd9e0150e7be86ab0338"
  from="David Allsopp &lt;dra-news@m...&gt;"
  author="David Allsopp"
  date="2009-10-09T15:28:08"
  subject="RE: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
<msg 
  url="2009/10/7c6d3ad6bfb93955eefdc3f0a47a181a"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T16:52:41"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</thread>

<contents>
&gt; Le 9 oct. 09 à 16:18, Damien Guichard a écrit :
&gt;
&gt;
&gt; Imagine my code is:
&gt; 
&gt;  type color = int
&gt; 
&gt;  let black : color = 0 
&gt; 
&gt; Then, following your proposition, evaluating black should give me
an int rather than a color because int is shorter and therefore nicer.

Hmm, I'd say that having OCaml respond "val black : int = 0" is indeed the
more useful answer (but not because int is shorter)... there are quite often
times where you get complex looking types (for good reason) which are in
fact aliases of much simpler types where it would (IMO) be much nicer for
OCaml to "call a spade a spade" and just tell you it's an int (Set.Make and
Map.Make being obvious cases[1]). Perhaps OCaml could make us both happy by
responding "val black : color = int = 0" (i.e. show the inferred and
possibly aliased type and also the principal base type, if it's different
from the inferred type)

The "unnecessary" complexity of the type names can also arise quite easily
if you're using with functors so need to present a particular type to
satisfy a signature - at which point having Foo.Bar.Other.Module.t (which is
in fact an int) may create irritatingly long type messages but the structure
being that way is probably hugely useful when it gets applied to
Magic.Make(Foo) elsewhere...


David


[1] Consider, somewhat obtusely, [let x : Map.Make(String).key = ""] (which
in real code is inferred rather more trivially from anything manipulating
sets and maps)

</contents>

</message>

