3 ms·
Terms like "straw man" imply that I'm trying to debate, but I'm not. You asked how correctness could be contrary to pragmatism, and I tried to provide an exampl
by wes-exp 13y ago
Terms like "straw man" imply that I'm trying to debate, but I'm not. You asked how correctness could be contrary to pragmatism, and I tried to provide an example.
- nbouscal 13y agoWhether or not it's a debate has nothing to do with whether or not your example is valid. I was just pointing out that it isn't.
- wes-exp 13y agoOut of curiosity, how would you define my example stringify function in Haskell with "no cost" safety around the argument type?
- Tuna-Fish 13y agoThe typeclass that provides "toString" in haskell is "Show". It defines a few functions, of which the important one is "show", which takes the original type and returns a string. A function that is equivalent to the java-ish example is: stringify s = show s No type definition is necessary, because the compiler can correctly infer the correct, most generic type: stringify :: (Show s) => s -> String Or, for any s in type class Show, a function that makes s into a String. Note that dispatch is done statically. Modern type systems eliminate most of the cost of type safety through good generics and type inference. Mainstream statically typed languages are just 20-30 years behind the state of the art. (note that the example actually can be reduced to: stringify = show)