Anyone who’s used Ruby has seen this message:r.rb:1:in `name': wrong number of arguments (3 for 2) (ArgumentError)
This particular error has been driving me nuts for years. It’s just so unnecessarily difficult to interpret — especially if Ruby’s not the only language you use. I never remember which number is which.
Compare toPython:TypeError: name() takes exactly 2 arguments (3 given)
This is better in several ways. The unambiguity; the tone (no “wrong”); the lack of line-noise characters; the plain-English sentence. Note also that the numbers are presented in the opposite order from Ruby. Not a problem in itself, but it makes the Ruby equivalent especially hard to interpret because it requires memorizing the difference.
As soon as Christmas, though, Ruby’s output look will look like this:r.rb:1:in `name': wrong number of arguments (given 3, expected 2) (ArgumentError)
This is a great step in the right direction.
It turns out that the issue had been raised two years ago. I gave the topic a bump, and Martin Dürstquickly commited the improved code. I am incredibly appreciative, and happy to see that core Ruby developers value improvements like these. In fact, there’s an open Request for Comments on improvements to Ruby’s error messages.
Ruby needs these kinds of improvements to compete with the incredible array of new, improved languages. I hope to see it become even more user friendly. It doesn’t need to look like Python in order to be more usable.