←back to thread

333 points steveklabnik | 1 comments | | HN request time: 0.207s | source
Show context
gurgeous ◴[] No.45035053[source]
I am so excited about this!! Ruby tooling is already pretty good, but we can do better. I will try to contribute. Now we just need types
replies(2): >>45035149 #>>45040884 #
dismalaf ◴[] No.45035149[source]
Please no types... They're worse than pointless for a dynamically typed language.
replies(5): >>45035235 #>>45035294 #>>45035575 #>>45035612 #>>45040464 #
pxc ◴[] No.45035575[source]
Sorbet can actually make programs crash at runtime if a variable's type doesn't match its annotation, right? It's not as busted as some other gradual typing implementations.
replies(2): >>45036553 #>>45037384 #
1. Lio ◴[] No.45037384[source]
I'm definitely in favour of gradual typing but runtime checking is already really easy to do if that's what you want. Just add a rightward assignment patten match to your method. e.g.

  def somemethod(foo, bar)
    foo => Integer
    bar => MyBarClass
  end
Personally I think the RBS-Inine format is the way forward. Sorbet has experimental support for it too.

https://sorbet.org/docs/rbs-support