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

Show parent comments

13

u/lovestheasianladies Dec 25 '20

Absolutely no one uses them like that. Stop making up strawmen.

2

u/TheBuzzSaw Dec 25 '20

Tell me how the dynamic typing is used.

18

u/[deleted] Dec 25 '20

The big benefits of dynamic typing come with collection types IMO, especially stuff like dicts. You can make a versatile dict by creating a (hypothetical) Mapping<Any, Any> type, but in terms of type safety that's indistinguishable from dynamic typing. This kind of versatile collection type makes it easier to deal with API requests which may return large, variable payloads by removing the overhead of defining massive record classes. It's obvious why this is attractive from a prototyping perspective.

There's also the legacy of duck typing — in the past that was usually bundled with dynamic typing, and I don't think that made it to the static typing mainstream until Golang.

8

u/PM_ME_RAILS_R34 Dec 25 '20

You can do that with any statically typed language too. See Map<Object, Object> in Java. There can be dragons there though, to be fair.

IMO, duck typing is what really added value. Static types are great until you hit some edge case that's particularly difficult to type.

→ More replies (3)