News for hackers. Stuff that matters.
Re:What else are we getting wrong about programming languages? by tome on Monday October 31, 2016 @09:18AM (#12836411)
What's wrong with just wrapping and unwrapping values as different types, at the few points you need to do so?
Re:What else are we getting wrong about programming languages? by js8 on Wednesday November 02, 2016 @02:39AM (#12852742)
Not only it becomes ugly, but it also doesn't help you in all situations.

Let's say you have a function in a library that has signature Int32 -> Int32. Then you realize you need to do the same thing, but for Int64. You can't reuse it by wrapping.

The above can seem silly, but problems like that are very real for Haskell strings.

I mean, from type-purity perspective, this behavior is OK. But from practical perspective (like Python's), it's a bummer. Why you shouldn't be able to reuse existing code just with different type signatures?

Re:What else are we getting wrong about programming languages? by tome on Wednesday November 02, 2016 @06:22AM (#12853412)
> Let's say you have a function in a library that has signature Int32 -> Int32. Then you realize you need to do the same thing, but for Int64. You can't reuse it by wrapping.

For that we have typeclasses.