[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic vs. static typing
Pascal Costanza <firstname.lastname@example.org> writes:
> On 24 Nov 2003, at 22:21, Joe Marshall wrote:
>> Any time you ask someone to provide redundant information, you strictly
>> increase the error rate.
> No, I don't think so.
If you manually type a redundant declaration, you either type it
correctly or you mistype it. If you type it correctly, this does
not fix any bugs in the program (because it is redundant). If you
type it incorrectly, you add a bug to the program.
Therefore, because redundant information can add bugs, but cannot
remove them, the error rate can only increase.
Now of course you cannot recover from errors without redundancy, but
if redundancy increases errors, how can this be? The answer is that
the recovery process needs to be able to fix both errors in the
original information *and* errors potentially introduced by the
redundancy. So although adding redundant information *increases* the
liklihood that you will have to enter the recovery process, the
redundant information *decreases* the liklihood of an error going
This is a good thing when the recovery process is automated.
If a human, however, is involved in the recovery process, the
redundant information makes more work for him --- he still has to fix
the original errors, but he also has to fix the errors introduced by
> Provided that you have the right idea of the thing you want to say,
> redundancy can be a win because it is not very likely that you
> describe the thing in a wrong way more than once. Especially when
> you provide two different perspectives on the same thing, and these
> views are compatible, it's more likely that you have a right idea.
Yes, the end reliability is likly to be higher, but there is strictly
more work to get there.
> I think this is the only _real_ advantage that static type systems
> provide. They provide two perspectives on the same code that are
> different in interesting ways. When these two perspectives match, you
> get a sense that you are up to the "right thing". And this is what
> static type systems have in common with, say, unit tests, or any other
> technology that provides interesting new perspectives on your code.
I actually disagree slightly. I'm lazy enough and vague enough that I
have typed things that are trivially incorrect (arguments in the wrong
order, for example). The error immediately shows up when I run that
branch of code, but it would be nice to find out sooner and a static
type check would have found this sort of thing.