Hacker News new | ask | show | jobs
by frou_dh 299 days ago
Static type-signatures are inevitable in general. You can see this by how even the Ruby documentation has to make up silly ad hoc notation like "→ array_of_strings", "→ matchdata or nil" etc.

(Random example): https://docs.ruby-lang.org/en/3.4/String.html#method-i-lines

1 comments

That's just documentation tool but the method is actually already statically typed by ruby.

I'm not sure why they don't link that in the documenation but I beleive it is something the RDoc mainer wants to do.

  def lines: (?string? separator, ?chomp: boolish) -> Array[String]
           | (?string? separator, ?chomp: boolish) { (String line) -> void } -> self
https://github.com/ruby/rbs/blob/master/core/string.rbs