

Strong Typing vs. Strong Testing (2003) - malisper
https://docs.google.com/document/d/1aXs1tpwzPjW9MdsG5dI7clNFyYayFBkcXwRDo-qvbIk/preview

======
ubertaco
Yes, static typing provides a(n incomplete) form of testing. But the other
thing that static typing provides is documentation. Compare these method
signatures:

    
    
        def distance(a, b)
    

vs

    
    
        def distance(a: string, b: string): decimal
    

Would you have guessed from the first signature that I'm calculating the
distance between two strings rather than the distance between two points? Or
the fact that the returned distance can be decimal rather than strictly
integral?

Yeah, I could name my function

    
    
        distance_between_strings_where_decimal_distances_are_allowed(a, b)
    

but it's more concise, just as effective, and compile-time-checked to write

    
    
        distance(a: string, b:string): decimal

