<?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="2002/07/16de9bda0d6614f523023e419ef92d08"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-17T07:53:47"
  subject="Re: [Caml-list] Sub{range,type} (was: Statically detecting arrays bound exceptions ??)"
  prev="2002/07/c2a08e45551c889a92cdde75e853bd34"
  next="2002/07/3f2c225830669dce5d13a01570f43023"
  prev-in-thread="2002/07/c2a08e45551c889a92cdde75e853bd34"
  prev-thread="2002/07/559d8c8c619d2fdc4d87eb6f282dca61"
  next-thread="2002/07/6f9d163bb49127c0bf96895d22c05290"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Re: [Caml-list] Statically detecting arrays bound exceptions ?? (was: Universal Serializer)">
<msg 
  url="2002/07/e97792a8a64614e000b7a7096a57651b"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-17T06:19:57"
  subject="Re: [Caml-list] Statically detecting arrays bound exceptions ?? (was: Universal Serializer)">
<msg 
  url="2002/07/04c53f5edda840f0c2342942bbacead0"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-17T06:47:04"
  subject="Re: [Caml-list] Statically detecting arrays bound exceptions ?? (was: Universal Serializer)">
<msg 
  url="2002/07/455bfaf53e9277eca0b090e59a694608"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-17T07:15:07"
  subject="Re: [Caml-list] Statically detecting arrays bound exceptions ?? (was: Universal Serializer)">
<msg 
  url="2002/07/c2a08e45551c889a92cdde75e853bd34"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-17T07:33:10"
  subject="Re: [Caml-list] Statically detecting arrays bound exceptions ?? (was: Universal Serializer)">
<msg 
  url="2002/07/16de9bda0d6614f523023e419ef92d08"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-17T07:53:47"
  subject="Re: [Caml-list] Sub{range,type} (was: Statically detecting arrays bound exceptions ??)">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
&gt; From: "Johan Baltié" &lt;johan.baltie@wanadoo.fr&gt;
&gt; 
&gt; &gt; &gt; In the second case, you should propagate the information from the
&gt; &gt; &gt; assertion to the loop bound, and additionally treat swap as if it were
&gt; &gt; &gt; inlined (we know it is its only call context).  
&gt; &gt; 
&gt; &gt; No it's not such a mess.  A subrange is a type. As ocaml is a bit
&gt; &gt; strong on is types it solves itself the problem
&gt; 
&gt; OK, I should have been clearer about my basic assumption: I was
&gt; talking about what you can do _without_ modifying the typing.
&gt; Modifying the typing is a mess: if your bounds are no longer integers,
&gt; then how can you convert between them and integers, back and forth.
&gt; You could use subtyping in one direction, but there is no implicit
&gt; subtyping in ocaml, as this would badly break type inference.

*sigh* :,(
I was dreaming of that kind of stuff.

But I do not see why type inference reach an end with subtyping.
Can you elaborate on this ?
 
&gt; &gt; &gt; And it's fragile:
&gt; &gt; &gt; if you move "swap" out of the function, then it might be used on any
&gt; &gt; &gt; array, and you have to do the bound check.
&gt; &gt; 
&gt; &gt; If you move swap out of the function, in another one using another array, the
&gt; &gt; type will change and a warning/error/check will occur if the types
&gt; &gt; are incompatible.
&gt; 
&gt; No, I was just saying moving swap to the toplevel:
&gt;   let swap arr i = ....
&gt; 
&gt; Supposing you use the original plain type, you are in trouble.
&gt; 
&gt; But it looks like you're just asking for dependent types, no less...

I did not know this name, and after a quick browse I can answer: "Yes" :)

 
&gt; I think this discussion started on efficiency considerations;
&gt; my belief is that you can already already optimize a lot, without
&gt; using fancy type systems. 
Ok, I left the previous thread, cause I'm getting totally of topic.

&gt; Such type systems are not only hard to
&gt; implement (and mix with an existing type system);  while they
&gt; certainly take bugs, they also get in your way when you get out of
&gt; their small understanding.
With my new and small understanding of dependent type, it seems to me that Ada
types look a lot like this. It seems to add power to the type checker, so why
would this be a bad thing ? Did I miss something ?


The only problem that I see is that if you consider list type dependent of size,
this kind of type cannot staticaly determined (is it the point that break type
inference ?).

Ciao

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

