[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More on dispatching by function return type




On Dec 17, 2003, at 3:15 PM, Kevin S. Millikin wrote:

> On Wednesday, December 17, 2003 12:19 PM, John Clements
> [SMTP:clements@brinckerhoff.org] wrote:
>> The problem here is one of locality: how far away in the program do
>> I have to look in order to understand what's happening in my little
>> corner of it?
>
> On average?  About as far as you would have to look to see what
> function is getting applied to the elements of a list in "map".
>
>> In languages like ML, Scheme, etc. etc. etc., I can figure out what
>> a function call will do, knowing only the inputs and the code of the
>> call itself (plus all that icky mutable state).
>
> Well sure, if you know "the code of the call itself" (I presume that
> means the body of the function, right?).  Statically determining that
> isn't a trivial problem.  On the other hand, Haskell *can* statically
> tell me which "read" is getting invoked or if it doesn't yet know.

Yes, Haskell can... by examining the result of the type proof.  This is 
my point, plain and simple:  in order to reason about the program, the 
programmer must be able to compute the result of the type proof.  This 
is not the case for other languages (e.g.--I claim--ML).

john