Live data from Hacker News

RBS, Ruby’s new type signature language

developer.squareup.com

31–40 of 340 posts

Re: RBS, Ruby’s new type signature language

#31
I'm not thrilled about the separate files with the type information but I completely understand why they did it, and if it were my choice I might make the same one.

I don't like the comparison with TypeScript `.d.ts` files however, because TS still lets you do types inline in the code. I haven't seen it mentioned anywhere that this won't be supported by Ruby 3.

Does anybody know if Ruby 3 will also support inline type information or will the header RBS files be required?

Re: RBS, Ruby’s new type signature language

#33
post #19

It has been so long since I last heard activities on Ruby. I had assume people moved on to Go or Rust for high traffic work by now.

> for high traffic work

Considering how prevalent Rails is for Ruby, we can assume that the majority of Ruby codebases are web apps. There are tons of way to scale Ruby web apps for high traffic, and a tiny minority of companies end up reaching a scale (like Twitter) where Ruby becomes infeasible.

Re: RBS, Ruby’s new type signature language

#34
post #24

At some point it makes more sense to switch to Crystal.

Crystal is a non-starter for me since the entire appeal of Ruby is the runtime metaprogramming.

Crystal has a nice AST based Macro system. IMHO it makes up for it. The problem with Crystal is no direct support for Windows OS compilation which is a non starter for many developers.

Re: RBS, Ruby’s new type signature language

#35

How does this compare to the sorbet project? Is it two different implementations for the same goal or is it adding support in ruby so sorbet can also benefit?

The sorbet project has an FAQ about that (I was curious too):

https://sorbet.org/docs/faq search for “RBS” (on mobile, no deep links)

Re: RBS, Ruby’s new type signature language

#37
post #9

Didn't realize Square was interested in Ruby type checking, just like their competitors over at Stripe. Lots of money riding on Ruby, I guess :) It does seem useful to have a _standard_ for type definitions - RBS as the equivalent to a .d.ts file - as that allows for different type checking implementations to use the same system under the hood. This was a big problem for Flow, and why it lost the fight as soon as Typ…

I'm not familiar with Ruby at all, but presumably it'd be possible to at least generate stubbed out definition RBS files with type inference.

Re: RBS, Ruby’s new type signature language

#38

How does this compare to the sorbet project? Is it two different implementations for the same goal or is it adding support in ruby so sorbet can also benefit?

AFAIU sorbet can consume RBS files, and probably produce them from libraries that use it.

But other type checkers could be implemented relying on the same information.

Re: RBS, Ruby’s new type signature language

#39
post #30

Separate ruby header files with type information? Seriously? What's the rational behind that? Is it just to make clear that the ruby interpreter doesn't really care about the type information and doesn't use it to improve the code's performance? With all due respect, but IMHO this is too little and much too late.

Isn't this similar to how TypeScript allows annotations for JavaScript to live in separate files? My (possibly naive) assumption is that the goal is to make it easier for developers to write type annotations for projects they use without necessarily having to convince the maintainers to add them to the project itself. I've heard of people using TypeScript annotations from https://definitelytyped.org/ for dependencies…

.d.ts files are mostly compilation output, only if the original source is JavaScript you write the definitions by hand. TypeScript developers normally work with types inside their ordinary .ts (JS+types) module file, not in a separate source file.
Post reply on HN