3 ms·
It’s all about message passing. Why not allow a compile time check if something respond to a message. Types/interfaces are good. Failing early is a good thing.
by jbverschoor 1y ago
It’s all about message passing. Why not allow a compile time check if something respond to a message. Types/interfaces are good. Failing early is a good thing. The earliest you can fail is during editing, and then compile/interpret time.
In Objective-C, you also pass messages to an object, and it could be anything you want. But it would output warnings that an object/class did not respond to a certain message. You could ignore it, but it would always result in a runtime error obviously.
[someObject missingMethod]
Swift is a much nicer language in terms of typing, and I have started replacing some smaller Ruby scripts with Swift. Mostly out of performance needs though. (Single file swift scripts)
The lack of proper typechecking is one of the main reasons I would not use Ruby, especially in larger teams.
Unittests are fun and all, but they serve a different purpose.
- dismalaf 1y ago> The lack of proper typechecking is one of the main reasons I would not use Ruby, especially in larger teams. Cool. I'm using Ruby for a startup because it's 10x more productive for building a webapp versus a compiled language and because I'm solo. And when I want typing I use something like C++ because I don't want to lose productivity without a major performance boost.
- corytheboyd 1y ago> I'm using Ruby for a startup because it's 10x more productive for building a webapp versus a compiled language I’ve been a Ruby/Rails dev for about 14 years. Just started working on Java projects at work and… holy shit, it slows down the entire organization and they don’t even seem to know how much of it is because of the terrible immovable object that is the mountain of Java code they made. Before this experience I had always assumed that rigid types alone would be a boon… oh how wrong I was. The rigidity just leads to people writing 10x more garbage to get simple things done, which causes a 10x worse maintainability problem. The rate at which I hear “oh lol just another NPE” is astounding, how is this constant occurrence not interpreted as a complete failure of the “type” system???? Maybe a crack team of Java Experts wouldn’t do this, but the reality of most software companies is that people of ALL skill levels are writing code. Poorly written Ruby is a whole lot easier to figure out (as an expert of Ruby) than 10x the amount of code in Java. I hate this.
- jbverschoor 1y agoThe productivity and joy come from the Ruby syntax, its standard library, most gems, and Rails. That is the best thing about Ruby, not the lack of being able to add type checks or interfaces