4 ms·
I really wish Ruby would grow up and deprecate method_missing
by stevebmark 6y ago
I really wish Ruby would grow up and deprecate method_missing
- whitepoplar 6y agoWhat's wrong with it?
- sigzero 6y agoNothing. There is nothing wrong with it at all except he "doesn't like" it.
- samgranieri 6y agoWhy? method_missing is one of the fun features of the language
- chrisseaton 6y ago> I really wish Ruby would grow up and deprecate method_missing method_missing is a deliberate and principled part of a message-passing approach to object orientated programming that gives you powerful options for composition and delegation. You can say you don't prefer this style of programming, but it's not well-informed to say it's down to immaturity or ignorance of alternatives on their part.
- choward 6y agoWhat do you mean by "powerful". Meaning you can type less code. You can still do delegation by writing it out yourself. Or you can also use the Delegator or Forwardable classes to save some typing. I'm not sure what meta programming they use under the hood. Probably define_method or method_missing. Also, people always forget to throw NotImplemented errors which can lead to some fun to track down bugs if you make a typo sending a message. Which I guess is why you pretty much have to write tests for everything in ruby. This kind of stuff would be caught by a compiler in other languages. Disclaimer: I don't buy into the idea of "message passing" or a lot of OOP. They're the microservices of programming languages.
- chrisseaton 6y ago> I don't buy into the idea of "message passing" or a lot of OOP. They're the microservices of programming languages. Then this probably was never the right language for you in the first place. But let's not say that people with different opinions about language design to you own need to 'grow up'.
- nurettin 6y agoMetaprogramming is an important part of ruby, so method_missing stays.
- stevebmark 6y agoNo, metaprogramming is a stain on software engineering that all ecosystems are moving away from. Except Ruby.
- cknoxrun 6y agoThis comment sounds so joyless. The programming language ecosystem allows for all sorts of approaches, some many folks love passionately, and some you may not like. However, your comment seems to suggest a whole swatch of software engineers are simply wrong/ignorant because they enjoy one of these paradigms that you don't. Burned or not in the past, I can't help seeing your comment as a form of anti-intellectualism.
- stevebmark 6y agoPlenty of people also probably loved GOTO
- djur 6y agoWhat evidence do you have of "ecosystems" moving away from metaprogramming? Last I checked, it was just as popular in C++ as it's ever been, and a number of high-profile new languages (Rust, Elixir, Nim) have made it a major selling point.
- cutler 6y agoDon't forget Clojure. Lisp wouldn't be lisp without meta programming/macros. Ruby has strong lisp roots and Ruby meta programming is what makes Rails so magical. Yes, we love magic in Ruby.
- smabie 6y agoNot really, almost all new languages support macros (Julia, Nim, etc).