News for hackers. Stuff that matters.
Re:Emulating Node.js Modules in Ruby by Argorak on Saturday October 19, 2013 @04:22PM (#6577652)
I am not sure whether this is a good approach, given how much module hierarchy matters in ruby. I came up with similar hacky things as the OP. I played around with ideas a few years ago and found an interesting gem:

#load actually allows you to load against an anonymous module to protect the global namespace. It would be interesting to provide a non-anonymous module there.

http://www.ruby-doc.org/core-2.0.0/Kernel.html#method-i-load

In the end, I found that deviating from such a fundamental part of the language to be less worthwhile than expected. The cognitive load of doing the "non-standard" thing is just to high.

There are no comments on this comment yet.