Hacker News new | past | comments | ask | show | jobs | submit login

Author here. As a longtime fan of Scheme and Lisp-based languages in general, I take responses like this very seriously. I'm not a huge fan of method_missing, and in practice I don't use it terribly often, but it has its place.

That said, the article is about something quite minimal in terms of metaprogramming: subclassing a class (Module), which would itself not be defined as metaprogramming at all, and then defining some methods on it in an initializer. I don't find this very convoluted at all: you're creating a prototype for a module which can be configured to use in a variety of contexts.

I wrote this article after having used this pattern in a very practical context (designing Mobility) to solve a very concrete problem: abstracting storage solutions (backends) from the interface for translating content. I found it to be a very concise and elegant solution in this context. I think a project like Rails would benefit in several places by adopting this pattern since it would actually simplify a lot of the code which already uses anonymous modules (basically the same mechanism) but in a very hard-to-understand way.

Comparisons to other languages like Clojure and Elixir bring with them a whole slew of other questions, since the languages are entirely different. I'd prefer to focus on Ruby itself and what the alternatives are within this language, and for the use case discussed I strongly believe Module Builder is the optimal solution, not a "mess" at all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: