Now imagine having a programming language which took this assumption as core design element...
Wasted an embarrassing amount of time debugging an error in Ruby where a method call on a class failed because the type didn't support said method.
It was the day i learned that in Ruby, every method always returns exactly one value. And you don't need to specifiy the "return" if it is the last line in a function. So my incorrect type was the return value of "Logger.Debug()" which was implicitly used as the return value because tge last "return" keyword is optional...
I normally don't wish harm upon anyone. But having to work with Ruby for some time now, i sincerely wish whoever made these decisions to stub their little toes on furniture twice every day.
I don't think it's intuitive to use the function name is the keyword for return at all. I've got other code I want to reuse and paste in to a new function I'm making with few changes, now I've got to change all the return instances to the new function name. What was so wrong with a command like RETURN?
Or if a function isn’t explicitly returning something, just do void, or null. But the language deciding for you that it must return something and if you don’t choose, it will? That’s just crazypants.
View all comments
Show parent comment
38
u/requion Sep 30 '26
Now imagine having a programming language which took this assumption as core design element...
Wasted an embarrassing amount of time debugging an error in Ruby where a method call on a class failed because the type didn't support said method.
It was the day i learned that in Ruby, every method always returns exactly one value. And you don't need to specifiy the "return" if it is the last line in a function. So my incorrect type was the return value of "Logger.Debug()" which was implicitly used as the return value because tge last "return" keyword is optional...