"Strong typing vs. strong testing"
lie.1296 at gmail.com
Sun Oct 10 12:01:49 CEST 2010
On 10/05/10 14:36, salil wrote:
> So, the programmer who
> specifically mentions "Int" in the signature of the function, is
> basically overriding this default behavior for specific reasons
> relevant to the application, for example, for performance. I think
> Haskell's way is the right.
I agree that in general, what Haskell did is correct, and a perfectly
reasonable design decision. In terms of *correctness* though, mandatory
infinite precision is slightly more correct, as you can't have a
clueless programmer writing Int, because he read somewhere that it's
faster, and blowing up the program. In practice, this never matters, as
we don't expect to see a lot of clueless programmers.
> It is providing "safe behavior" as
> default and at the same time treating programmer as adults, at least
> in this case.
> I think dynamic languages are attractive because they make programs
> less verbose. But, statically typed languages with type inference
> (Haskell, OCaML, Scala, F#) is a very good compromise because they
> offer both type safety and succinctness. And when we need algorithms
> that should work the same independent of types, Haskell has
> typeclasses which are pretty intuitive, unlike the horrible C++
Agreed. Dynamic language and implicit static typing are two very good
compromises for writing succinct codes. Implicit static typing lends to
better type safety, while dynamic typing lends to better reflection and
meta-programming. Both while preserving code succinctness.
More information about the Python-list