Live data from Hacker News

RBS, Ruby’s new type signature language

developer.squareup.com

71–80 of 340 posts

Re: RBS, Ruby’s new type signature language

#71

It's worth noting that while the article is coming from Square, this is an official Ruby project and is "Ruby 3’s new language for type signatures". https://github.com/ruby/rbs

Yeah, I was wondering why this was being announced on Square's website. Seems it's because Square happens to employ Soutaro Matsumoto, who wrote the post and is also the creator of Steep[0] (an implementation of a typechecker for RBS files).

It's not clear to me whether Soutaro is a member of the Ruby core team, so it feels a bit odd that the post is written like an announcement from the Ruby maintainers.

[0] https://github.com/soutaro/steep

Re: RBS, Ruby’s new type signature language

#72

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

Crystal is pretty unstable at the moment (in that it changes often). I have a very small project in crystal (discord bot with only a couple of commands that CRUDs a database). Every time I deploy to heroku, if heroku updated crystal, the bot breaks. I have to spend an hour determining what broke. The language changes so often that either I update with heroku or I can't use any newer libraries for development. And the…

> Crystal is pretty unstable at the moment (in that it changes often)

This had never been my experience, I have a server written fully in crystal running in production serving millions upon millions of requests on heroku and crystal doesn't break a sweat.

Quite happy with it so far.

Re: RBS, Ruby’s new type signature language

#74
post #58

Earlier quoted context omitted.

And JavaScript and Python, and a whole host of languages that didn't care about strong typing

None of these were the first untyped languages, or even the first widely used untyped languages.

In fact none of them are "untyped". They are strongly typed.

BCPL could conceivably be described as untyped.

Re: RBS, Ruby’s new type signature language

#75
post #42
post #7

Earlier quoted context omitted.

Crystal is amazing (we sponsor it at Fly.io), but the sheer amount of stuff that's already built for Ruby makes it hard to switch to another language. Node has had 10 years and its still not there.

> still not there And never will be.

Not sure what you're saying. What are places where Node isn't caught up to Ruby and can never catch up to Ruby?

Ruby on Rails seems like a kneejerk response, but then again it doesn't exist because nobody really wants it, not for technical reasons.

For example, Python has all the ML/math stuff. Nothing comes to mind for Ruby.

Re: RBS, Ruby’s new type signature language

#76
post #22
post #18

> Typed versus untyped is a 30-year-old issue for programming languages. I'm pretty sure the merits of typed vs untyped has been going on since the 1950s at least. 30 years is such a specific period of time that it makes me wonder what happened in the early 90s that the author is referring to.

Ruby was invented? :)

Nope, that happened 5 years later.

Re: RBS, Ruby’s new type signature language

#78
post #48

I absolutely hate this. Separate files for types with no inline annotations possible? What an embarrassing compromise. This is all because Matz explicitly won't allow type signatures in .rb files. I wonder how long it'll be until a hostile fork if he doesn't change his mind.

If you can't calmly go "ah, I see why they did X, but I would prefer if they did Y," I think the problem is only on your end. Let's be adults/engineers.

I've found that if all you can say is "I hate this", you usually don't actually understand the trade-offs.

In the meantime, you have Sorbet available. What's the problem?

Re: RBS, Ruby’s new type signature language

#79

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 typ…

I much prefer separate files for type declarations. Or at least the ability to define them separately. Type annotation takes away from readability. I like keeping the types and code separate.

> Type annotation takes away from readability.

I don't disagree, but I think it's a very minor issue given that it's trivial to use color to highlight code these days. By comparison having to switch between two files (and keep them in sync!) when making changes is a far bigger usability concern.

Post reply on HN