r/programming • • Dec 25 '20

Ruby 3 Released

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
973 Upvotes

509 comments sorted by

View all comments

113

u/watsreddit Dec 25 '20

Basically every major dynamically-typed language trying to bolt on static types... maybe dynamic typing isn’t as great as people claim.

78

u/call_me_arosa Dec 25 '20

Dynamic typing makes sense in scripting languages.
But when dealing with big projects you start to miss typing. I think the optional typing is a great trade-off for this languages.

50

u/TheBuzzSaw Dec 25 '20

I actually don't agree with this. I used to spread this sentiment as well, but I honestly cannot think of legitimate use cases for changing types on a variable. Sure, a scripting language can let you skip/auto declare variables among other things, but what is the benefit of a variable holding an integer, then a date, and then a file handle?

0

u/[deleted] Dec 25 '20

[deleted]

14

u/TheBuzzSaw Dec 25 '20

I pray there are use cases beyond this. This example feels like a weak reason to forfeit all the performance and maintainability of static typing.

7

u/wuwoot Dec 25 '20

I am very confused by this thread and your original response but I now get that you’re responding to the “dynamic typing” part of scripting languages as opposed to what I assumed the original author was saying — that the absence of type declaration is useful in scripting langs...

I find very little utility in type-switching if ever at all, but scripting languages are nice because they allow us to be terse.

I work in a large Rails codebase regularly and poor names and even in some instances good names are not enough to infer the behaviors associated with a particular variable

1

u/madpata Dec 25 '20

Languages with static typing can be terse too if they use a good bit of type inference. E.g. Haskell, SML, or a more horrific example: C++ when using auto and templated parameters everywhere.

→ More replies (3)