<br><div><span class="gmail_quote">On 6/11/07, <b class="gmail_sendername">Carl Eastlund</b> &lt;<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; You say add1 is int -&gt; int, but it accepts real numbers too, so it<br>&gt; could be real -&gt; real, or number -&gt; number.&nbsp;&nbsp;On the other hand, a<br>&gt; general number -&gt; number function is not acceptable as int -&gt; int
<br>&gt; because it might return a non-int, and add1 is a valid int -&gt; int<br>&gt; function, so no one of these specifications is adequate for it.</blockquote><div><br>Ah - I misread add1&#39;s definition, thanks for the correction.
<br><br>On the other hand, if int is a subtype of number, shouldn&#39;t a number -&gt; number function suffice as its definition as it can return int -&gt; int as well?&nbsp; <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; But wait, there&#39;s more.&nbsp;&nbsp;In PLT Scheme, you can apply add1 to a<br>&gt; non-numeric value and run the code.&nbsp;&nbsp;It may raise an exception, but<br>&gt; there&#39;s nothing wrong with that.&nbsp;&nbsp;In fact, even statically typed
<br>&gt; languages like ML allow programs to raise an exception, and -- here&#39;s<br>&gt; the fun part -- this behavior is generally allowed to have any return<br>&gt; type.&nbsp;&nbsp;So add1 can also be assigned the type any -&gt; any, and if you
<br>&gt; really want to you could assign it types like string -&gt; symbol or<br>&gt; list-of-vector -&gt; vector-of-list.&nbsp;&nbsp;(The funny logic goes: because it<br>&gt; will never return a value on those inputs, every value it does return
<br>&gt; vacuously belongs to the type symbol or vector-of-list.)</blockquote><div><br>But raising exception here means the type of the parameter is incorrect - i.e. it still has a type semantics, even though checking is deferred to runtime rather than compile time, right?
<br><br>Just to be clear, I am not looking for a static type system (although some of its properties are nice).&nbsp; I am &quot;okay&quot; with run-time type checking rather than compile time, I just find it more cumbersome to do type-based dispatching. 
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt; As you can see, even apparently simple functions like add1 can have<br>&gt; many different, complicated types.&nbsp;&nbsp;Assigning a single one is a
<br>&gt; shortcut used by some static type systems to simplify their job, thus<br>&gt; restricting the use of such functions to that single type.&nbsp;&nbsp;PLT Scheme<br>&gt; lets you use add1 as any of the above types, thus it cannot tell you
<br>&gt; which type the function has.&nbsp;&nbsp;Its type is any and all of the above.</blockquote><div><br>I understand typing is not easy, and that&#39;s why many languages come with a type system and developers just use it rather than inventing their own.&nbsp; My take here is that scheme also has a type system (at least for the value objects) but type is not a first class citizen like lambda or continuation, and hence make type-based programming more effort.
<br><br>It does seem that most of the responses are about that you cannot type them all and hence there isn&#39;t a complete type system that can do (typeof obj) - is this a correct assessment?&nbsp; Is this a done subject (i.e
. there are proofs that one cannot type everything that can be computed) or is this just the current state of art? <br><br>Thanks,<br>yc<br><br></div></div>