TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Ruby Module Builder Pattern

94 pointsby shioyamaabout 8 years ago

5 comments

fishnchipsabout 8 years ago
I'm familiar with dry-rb coding style and I think it is very difficult to reason about. Metaprogramming often feels like magic but it comes at a price - hard for newbies to grok and impossible for static tools to work with. I would only advise using it (if at all) in well-tested libraries that expose a well-documented public API.
评论 #14389240 未加载
评论 #14387944 未加载
评论 #14388547 未加载
评论 #14387976 未加载
评论 #14388562 未加载
评论 #14389541 未加载
评论 #14394016 未加载
thomasfedbabout 8 years ago
I&#x27;m an experienced Rubyist who&#x27;s done their fair share of horrible hacky things.<p>This is quite nice. It avoid some of the issues that other metaprograming techniques will land you, and the associated debugging hell.<p>Nicely written too.
cutlerabout 8 years ago
This article demonstrates the mess you can get into when you mix OOP with metaprogramming and why Ruby has a bad reputation for encouraging it. Metaprogramming seems to compound the contortions of OOP in contrast to the elegance macros add to functional languages like Clojure and Elixir. Ruby&#x27;s method_missing and instance_eval seem like ugly hacks compared with the simple quote&#x2F;unquote of Lisp-based languages.
评论 #14389952 未加载
p4lindromicaabout 8 years ago
At first pass, this looks very similar to the typeclass pattern in Scala
clairityabout 8 years ago
i like the hand-drawn class diagrams. =)<p>i wish there were more of these (ruby) metaprogramming articles, since there is a lot of ingenuity going on under the covers.<p>it&#x27;s just like jargon in specialized fields - so much is packed into so few symbols. it allows those who understand it to express more complex ideas more easily but also serves as a barrier to those unfamiliar with the jargon.
评论 #14390462 未加载