"Strong typing vs. strong testing"
RG
rNOSPAMon at flownet.com
Thu Sep 30 04:40:43 EDT 2010
In article
<5bf24e59-1be0-4d31-9fa7-c03a8bf9bd21 at y12g2000prb.googlegroups.com>,
TheFlyingDutchman <zzbbaadd at aol.com> wrote:
> > > Yes. Nonetheless, the maximum() function does exactly what it is intended
> > > to do *with the inputs it receives*. The failure is outside the function;
> > > it did the right thing with the data actually passed to it, the problem
> > > was a user misunderstanding as to what data were being passed to it.
> >
> > > So there's a bug -- there's code which does not do what it was intended
> > > to do. However, that bug is in the caller, not in the maximum()
> > > function.
> >
> > > This is an important distinction -- it means we can write a function
> > > which performs that function reliably. Now we just need to figure out
> > > how to call it with valid data... :)
> >
> > We lost some important context somewhere along the line:
> >
> > > > > in C I can have a function maximum(int a, int b) that will always
> > > > > work. Never blow up, and never give an invalid answer. If someone
> > > > > tries to call it incorrectly it is a compile error.
> >
> > Please take note of the second sentence.
> >
> > One way or another, this claim is plainly false. The point I was trying
> > to make is not so much that the claim is false (someone else was already
> > doing that), but that it can be demonstrated to be false without having
> > to rely on any run-time input.
> >
>
> The second sentence is not disproved by a cast from one datatype to
> another (which changes the value) that happens before maximum() is
> called.
You can't have it both ways. Either I am calling it incorrectly, in
which case I should get a compiler error, or I am calling it correctly,
and I should get the right answer. That I got neither does in fact
falsify the claim. The only way out of this is to say that
maximum(8589934592, 1) returning 1 is in fact "correct", in which case
we'll just have to agree to disagree.
rg
More information about the Python-list
mailing list