On Sat, 21 Dec 2013 00:18:33 -0800, Dan Stromberg wrote:

> C++ should use automated tests too, but is often used without because
> the compilers make it almost reasonable to do without.

For some definition of "reasonable" that I haven't come across before. 
I'd like to see the compiler that can determine which of the following 
pseudo-code functions is buggy:


# Given the length of the shadow cast when the sun is at
# angle degrees measured from the horizontal, return the
# height of the thing casting the shadow.

def calculate_height(length:float, angle:float):float;
    if not 0.0 <= angle < 90.0:
        Error, "angle out of range"
    if not length >= 0.0:
        Error, "length cannot be negative"
    return length*sin(degrees_to_radian(angle))

def calculate_height(length:float, angle:float):float;
    if not 0.0 <= angle < 90.0:
        error("angle out of range")
    if not length >= 0.0:
        error("length cannot be negative")
    return length*tan(degrees_to_radian(angle))


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to