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

Re: dynamic vs. static typing

Matt Hellige writes:
> This is both true and useful. But what's the point of permuting the
> elements of a list if no other part of the program can or will ever
> inspect the values? In fact, how could one even determine that such a
> permutation had been done?

If no other part of the program ever looks at the contents of the
list, then of course you are correct that there's no point in keeping
its elements around. But does this ever really happen? I think it's
more common for one *part* of a program (say, one function) to not
look at the contents of a list, and for another function to do so.

Parametricity is a convenient way of saying "This function doesn't
look at the contents of the list it was passed". So when the program
has a bug with the values, you know you that the parametric function
isn't going to be where the problem is. So it can make debugging

The reverse is also true -- if the computer infers a polymorphic type
when you know that the function *should* compute on it's argument,
then you've found a bug. Here's a link to a real-life example of this
that happened to me:


Neel Krishnaswami