←back to thread

511 points mootrichard | 2 comments | | HN request time: 0.412s | 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. RangerScience ◴[] No.23991252[source]
I think it's moderately clear that they're not intending this be a complete solution to type checking in Ruby, but rather a starting point that the community can build on top of.

For instance, I can imagine adding something like comment blocks to Ruby code that RBS tooling can find and treat like the RBS files.

replies(1): >>23991479 #
2. vidarh ◴[] No.23991479[source]
Treating it as a starting point is, I think, the best justification for putting them in separate files. I don't quite like the idea of having them in separate files, but at least that way replacing it or evolving it without breaking peoples code-bases will be easier.