←back to thread

140 points ksec | 3 comments | | HN request time: 0.593s | source
Show context
simply-typed ◴[] No.41083880[source]
The fact IntelliSense and jump-to-source are supported at a very superficial level goes to show the heavy drawbacks of dynamic types.

Sorbet may fix things, but at that point, just use a language with more mature tooling around types, like Python or TypeScript.

Dynamic types offer dubious marginal benefits but bring tons of downsides. The demonstrations in this article reflect that.

replies(6): >>41083934 #>>41083947 #>>41084060 #>>41084088 #>>41084115 #>>41084491 #
ecshafer ◴[] No.41083934[source]
I like coding in Ruby a lot more than Python or Typescript. From using the Ruby LSP in the article daily (though I am not on the team) I can say it works quite good and I have very few issues with navigating Ruby source. If I were very worried about types, going to Python or Typescript seems like not a very good solution. Python barely has more type support than Ruby, and Ruby is making a lot of gains in this area. Might as well go to an even more expressive and powerful language like F#, Haskell, Ocaml, Scala, or similar.
replies(2): >>41084293 #>>41085751 #
maleldil ◴[] No.41084293[source]
> Python barely has more type support than Ruby

That's not true. mypy and Pyright (the main type checkers) are very ahead of Ruby's Sorbet, and Python actually has proper ergonomic syntax to work with types, which Ruby doesn't. It's also seeing constant development to bring more powerful typing and syntax.

Also, typing has become part of the Python culture, which means most of the big libraries have type hints. It doesn't seem like that is the case with Ruby, where type hints aren't as prevalent. Even the core maintainers don't like the idea and want to keep it as dynamic as possible.

replies(1): >>41084439 #
jshen ◴[] No.41084439[source]
I've had the hardest time getting mypy to work well in vscode. Trying pyright with neovim now, curious how it goes.
replies(2): >>41084540 #>>41084738 #
teaearlgraycold ◴[] No.41084540[source]
pyright just requires the Microsoft Python extension. In my experience once you have that it works instantly.
replies(1): >>41085487 #
1. psychoslave ◴[] No.41085487[source]
I don't know Pyright, but is it still Python? It's probably fair to bring it as Sorbet is mentioned, if course. But you can't use Sorbet using a pure ruby interpreter, if I'm getting it correctly, and I guess it's the same for Pyright. It's that so?
replies(2): >>41086017 #>>41088963 #
2. thenipper ◴[] No.41086017[source]
Mypy/pyright aren’t interpreters. They’re basically just linters that you run against Python code to see any typing issues. I don’t mean that dismissively,they’re great tools.
3. maleldil ◴[] No.41088963[source]
Pyright and mypy are typecheckers, completely orthogonal to the interpreter. They work like linters that statically perform type checking. By default, Python's type hints are ignored at runtime (i.e. you can do `x: str = 2`, and the runtime doesn't care), but there are tools to perform runtime checks (e.g. beartype) and libraries that make use of types as metadata (e.g. dataclasses, Pydantic, FastAPI).