←back to thread

511 points mootrichard | 1 comments | | HN request time: 0.206s | source
Show context
swagonomixxx ◴[] No.23991156[source]
I haven't used Ruby in ages but this seems like a really odd way to incorporate type hints in the language.

I much prefer the Python 3+ approach of type annotations in source code.

I can't imagine having to look at a separate file just to figure out what the type of something is. You may say "tooling will fix this" but it's just far less overhead for everyone at the end of the day to just make annotations in source.

My more existential question is, is there really an advantage to doing static type checking in Ruby?

When I was doing Ruby, the way you can change objects on the fly, add methods on the fly, the vast amounts of metaprogramming, are types at "compile" (I know, not really) time really the same as types at runtime?

Like, it might be nice to get some autocomplete, but AFAIK tools already do that (RubyMine, others).

replies(5): >>23991225 #>>23991242 #>>23991244 #>>23991252 #>>23991292 #
1. miohtama ◴[] No.23991225[source]
You might be correct.

There have been attempts to have types outside the main source or in comments for many dynamically typed languages. They seem to fail due bad programming ergonomics, as maintaining separate "header" files is cumbersome (hello C my old friend).