<?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/16051196b9d9c0d5bf42b865d44384e1"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:40:28"
  subject="Improving OCaml&apos;s choice of type to display"
  prev="2009/10/8e3d11feb29d6e87bc0312a82b1d13ea"
  next="2009/10/87470a289690e18edbff126b5a7a8ac3"
  next-in-thread="2009/10/87470a289690e18edbff126b5a7a8ac3"
  prev-thread="2009/10/cc30b4a069b2db9ebf8f94287b328051"
  next-thread="2009/10/1b087dcc1f0f6132c02c68dbbb67bc95"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/16051196b9d9c0d5bf42b865d44384e1"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:40:28"
  subject="Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/87470a289690e18edbff126b5a7a8ac3"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T01:53:44"
  subject="Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/0bc68c82ed4a6bba68f2636134143811"
  from="Jun Furuse &lt;jun.furuse@g...&gt;"
  author="Jun Furuse"
  date="2009-10-11T14:57:19"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/8349209de209281dbf73cb3888588769"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-11T15:12:50"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/a404572b7e870ab6714732d61e9bddd8"
  from="Jun Furuse &lt;jun.furuse@g...&gt;"
  author="Jun Furuse"
  date="2009-10-11T15:24:44"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/178203bcf6f42213ff6d6e53b37b8707"
  from="Gilles Pirio &lt;gilles.ocaml@g...&gt;"
  author="Gilles Pirio"
  date="2009-10-11T19:57:29"
  subject="Re: [Caml-list] Re: Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2009/10/bbdefe2c53d985fa64407ffd30ff459f"
  from="Andrej Bauer &lt;andrej.bauer@a...&gt;"
  author="Andrej Bauer"
  date="2009-10-09T07:33:02"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/b3f619ad26ab41cd18d0a4116614e3e7"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T09:58:06"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/44e5fad445afd1b1dba8516fa33c6a94"
  from="Alp Mestan &lt;alp@m...&gt;"
  author="Alp Mestan"
  date="2009-10-09T10:54:35"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
<msg 
  url="2009/10/a0a18c8e566ee5672d4e68e674953947"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-10-09T11:15:03"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
<msg 
  url="2009/10/4f1ff557b4a8b3d66e406db6212e2860"
  from="Stephen Weeks &lt;sweeks@s...&gt;"
  author="Stephen Weeks"
  date="2009-10-09T18:14:12"
  subject="Re: [Caml-list] Improving OCaml&apos;s choice of type to display">
</msg>
</msg>
</msg>
</thread>

<contents>
Anyone who plays around with the Core library that Jane Street just released
can see showcased a rather ugly detail of how Core's design interacts with
how OCaml displays types.  Witness:

# Int.of_string;;
- : string -&gt; Core.Std.Int.stringable = &lt;fun&gt;
# Float.of_string;;
- : string -&gt; Core_extended.Std.Float.stringable = &lt;fun&gt;

I'd be much happier if this was rendered in the following equally correct
and more readable form:

# Int.of_string;;
- : string -&gt; Int.t = &lt;fun&gt;
# Float.of_string;;
- : string -&gt; Float.t = &lt;fun&gt;

Or even:

# Int.of_string;;
- : string -&gt; int = &lt;fun&gt;
# Float.of_string;;
- : string -&gt; float = &lt;fun&gt;

And this isn't just an issue in the top-level. The compiler also displays
types in the same difficult to read form.  I'm wondering if anyone has some
thoughts as to what we can do to make the compiler make better choices
here.  There are two issues to overcome:

   - Dropping the module name.  I'd love to give the compiler the hint that
   Core.Std. could be dropped from the prefix in a context where that module is
   open.  This is what's done with the pervasives module already, I believe, so
   it seems like it should be doable here.
   - Choosing shorter names.  This one seems harder, but there are various
   different possibilities for what type name to print out, and a reasonable
   heuristic to use might be to pick the shortest one.  Part of the reason
   these issues come up is our use of standardized interface components (that's
   where the "stringable" type name comes from).  I suspect this one will be
   hard to fix, sadly.

Anyway, we'd be happy with any suggestions on how to improve matters.

y

</contents>

</message>

