Hacker News new | past | comments | ask | show | jobs | submit login

> What’s awesome about Ruby?

> Dynamically typed

As someone who has experienced the joy and at least some feeling of safety from moving to typescript from javascript, I would seriously question that dynamic typing is awesome.




I reject the implication that if dynamic typing is awesome, then static typing is _not_ awesome.

It’s like saying pizza is awesome, therefore ice cream is not.

Both are awesome! It just depends what you’re trying to achieve at that point in time. A language’s type system is not, in absolute terms, an advantage or disadvantage. It’s just a design choice, each with their own trade-offs that we must consider.


I tend to like when languages are dynamically typed, but I suspect it's not the dynamic typing I like--I think it's that dynamically-typed languages generally have type inference.

I don't like having to write things like `List<int> list = new List<int>`... I find myself thinking, "Why do I need to tell the stupid compiler in the very same line that a new List<int> is a List<int>? Wtf else would it be?!"

When I write in a language such as Kotlin, that's statically typed but has type inference, I feel basically the same lack of resistance as I feel working in dynamically typed languages. Of course, even in such languages, there'll be times when the coder must specify a type, or should specify one for various reasons, but I like when the compiler at least makes an effort, haha.

I like Ruby a lot (and I've tried out Crystal in some recreational programming stuff and like it a lot too), and I think I'd still like it just as much without the dynamic typing.


As someone who was on the type train in Uni and moved to dynamic languages, my first feeling was slow and unsafe. I couldn't imagine how things wouldn't just explode. In practice I've rarely seen issues. Ruby is still the fastest way for me to get a concept working. I'd definitely consider it awesome.


not all dynamically typed languages are the same, Ruby is strongly typed and JavaScript is generally described as a weakly typed language.


The word "strong" is not well defined in this context. But usually it is used for languages like Haskell, Idris, PureScript and Elm.

Ruby does not do as many automatic casts as JS. In this regard it may be seen as "stronger".


Ruby matches this definition: https://www.wikiwand.com/en/Strong_typing

Crystal has static type checking though.


Strong is frequently used incorrectly and as such the meaning has been diluted.

But used the way the OP is using it, strong vs weak is different from static vs dynamic.


I’d hardly call ruby strongly typed. There is basically no way to verify anything statically so almost all issues show up in run time. Updating Rails or any gems on a production system is a nightmare where the only option is to have 20,000 unit tests and then hope nothing blows up when you release it.


You have confused strong typing and static typing.


Some of us need the latter for the former.

What would you say some of the strengths of Ruby's type system are?


Ruby 3 supports type signatures: https://github.com/ruby/rbs


The rails creator DHH has indicated that rails would “absolutely not” be getting type support.


That's absolutely the correct call for rails.


It's the main reason I see Rails not lasting another decade. All the Rails apps I have been working on become almost unmanageable after 6+ years because keeping things updated on an untyped system is borderline impossible to do safely.


There are solutions like sorbet[^1] and sorbet-rails[^2]. Have you tried them?

[^1]: https://sorbet.org/

[^2]: https://github.com/chanzuckerberg/sorbet-rails


Just because Rails is untyped doesn't mean you can add type definitions to your own code within a rails application.


This is the problem when people only know one language, especially javascript. And then have quite naive opinion about programming languages. Ones should try at least all one of big categories; one of ML family, one of C-like, one of Lisp dialect.


> This is the problem

Could you state the problem more concretely? Javascript is a cross between Java and Lisp, having a Java-esque C-like syntax, and lisp-like function-as-a-first-class-citizen behavior. Typescript brings it all the way to C#; so the C-like territory is firmly covered. An ML-family language, especially something like Haskell, would only reinforce the admiration for static types. Which languages would lead to the conclusion that dynamic typing is awesome? Lisps?


Oh god you are bending some broad aspects to back it up that Javascript has all of greatness from every other style of programming. No, it doesn't. I don't think it works like that. It's like a p10 of jack of all trade.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: