←back to thread

333 points steveklabnik | 1 comments | | HN request time: 0.001s | 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 #
bmacho ◴[] No.45040464[source]
All dynamically typed Ruby competitors like

  Python, Javascript (via Typscript), PHP, Elixir 
have embraced Gradual Typing/Type Inference.

You use typed variables/typed function signatures when it's convenient, they give you some compile-time contracts, easy documentation and probably even speed. Otherwise they don't exist. I don't do Ruby, but Gradual Types/Type Inference is a no-brainer for dynamic languages, practically no drawback, only benefits. (And popular statically typed languages such as C/C++, Java, Rust support Type Inference, or are going there too.)

replies(1): >>45040797 #
dismalaf ◴[] No.45040797[source]
Cool. People who want gradual typing can use those and leave Ruby alone.

> I don't do Ruby

So why have an opinion?

Languages I use: Ruby, C++, Odin, R. I'm not about to to around telling Rust, Python or Typescript people they're doing their languages wrong, even if there's things I hate about those languages. I just don't use them.

replies(1): >>45041283 #
jameslk ◴[] No.45041283[source]
Ruby already has this with Sorbet. Nobody is forcing you to use it, are they?

It seems you have a lot of opinion here without really discussing your problem with type hints though. What is it you dislike?

I use Ruby regularly, have used it for more than a decade, and I wish it had something like a TypeScript equivalent (Sorbet is sorta this but not enough). Every time I work with a Ruby codebase without Sorbet, it’s a lot of guessing and praying that test coverage is good enough. It’s not fun having to find out in prod there’s dumb bugs that would have been caught by static analysis. Something I experience virtually never in TypeScript, the other language I’ve also used for a decade

replies(2): >>45041430 #>>45042203 #
1. tracker1 ◴[] No.45042203[source]
Even after over a decade with TypeScript, I'm still kind of mixed on it... there are a lot of times where trying to wrangle typing is more painful than it should need to be... I'll often just cast to any, then I have to add a comment to suppress the error message with the default config. I use deno a lot and tend not to mess with the default configuration there. Even with node/npm, I still don't do much with the tsconfig beyond what a minimal need is.

It's not as painful as earlier versions and is generally okay to work with... but there are definitely times you need to work around the typing as opposed to with it. For example extending/using context in hono/oak/koa so you get hinting, but want your endpoint handlers in separate modules. It gets very messy, very quickly.