Re:My Love Letter to Rails (and Ruby) – Or, Why RoR Isn't De...
by sinkwool on Tuesday October 24, 2023 @07:31AM
(#37997555)
ruby is strongly typed, in that it doesn't allow you to implicitly coerce between types*: 1 + "1" will raise an error. (As opposed to weak typing in C or JS)
ruby however is not statically typed.
*(there are actually ways to implement certain types of coercions by defining to_ary, to_str, to_int)
Re:My Love Letter to Rails (and Ruby) – Or, Why RoR Isn't De...
by werdnapk on Tuesday October 24, 2023 @08:10AM
(#37997990)
Ruby has Sorbet and RBS as options to integrate types into Ruby projects, so Ruby isn't sitting still on this front.
Re:My Love Letter to Rails (and Ruby) – Or, Why RoR Isn't De...
by e12e on Tuesday October 24, 2023 @09:03AM
(#37998614)
Having seen how well typing works with python and FastAPI - I'm afraid the current path ruby is on isn't great, unfortunately. It feels extremely bolted on - but I hope something useful and enjoyable will come out of the various typing efforts.
Re:My Love Letter to Rails (and Ruby) – Or, Why RoR Isn't De...
by veidelis on Tuesday October 24, 2023 @08:39AM
(#37998297)
Isn't ruby strong and dynamic?
Re:My Love Letter to Rails (and Ruby) – Or, Why RoR Isn't De...
by ninkendo on Tuesday October 24, 2023 @10:52AM
(#37999991)
There's no type annotations (outside of experiments), and thus no way for a "compiler" step to tell you if you're passing an array to a function that expects a string or something. The "strong" typing doesn't happen until runtime, so the closest you can get to this is writing a unit test that asserts on the behavior you want (assert that this method raises an exception when I pass an array, etc.) This is what people mean by "typed languages". Ruby isn't one of them.
I feel like there’s a real shift towards strong (er) typing.
What does this mean for Rails?
My main language has been Python for a long time now but I’m really coming to prefer typescript for certain applications.
Does Ruby remain relevant as the industry moves towards typed languages?