Earlier quoted context omitted.
> Now I say "strong typing is a wonderful test suite you get for free and automatically stays up to date". Not that it replaces tests; but it literally a wonder how Haskell's HM-typesystem it rejects broken code at compile time. Ruby is strongly typed.
That's true. But in practice I've come to the idea it's a meaningless distinction if you're not going to bother to declare the types on your methods/functions. Instances may be Strongly typed in Ruby. Methods are not. So you get almost none of the benefit. It's like Types only exist in Ruby to support Mixins and inheritance chains. Prefer Composition over Inheritance right? But what if through Composition you effecti…
Sure they are, just not all of them:
[].first('wat') # => TypeError: no implicit conversion of String into Integer
What Ruby lacks is _static typing_ and compile time checks of these types.
Instead we have runtime checks in a few places.> Prefer Composition over Inheritance right? But what if through Composition you > effectively lost all your Type information? That's the issue Ruby presents.
This is mainly advocated because subclassing core classes (e.g. Array) can lead to weird behaviour. For example:
class MyArray Array
Here one would probably expect an instance of MyArray to be returned, but
instead we get a vanilla Array.