On Sep 30, 1:40 am, RG <rnospa...@flownet.com> wrote: > In article > <5bf24e59-1be0-4d31-9fa7-c03a8bf9b...@y12g2000prb.googlegroups.com>, > > > > > > TheFlyingDutchman <zzbba...@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. > 1) long trying_to_break_maximum = 8589934592; 2) /* compiler adds */ int created_to_allow_maximum_call = (int) trying_to_break_maximum; 3) maximum(created_to_allow_maximum_call, 1);
I think we have to agree to disagree, because I don't see the lack of a compiler error at step 2 as a problem with the maximum() function. -- http://mail.python.org/mailman/listinfo/python-list