Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It allows you to namespace things that aren't themselves namespaced. That way you can just require things that, might say, have the same module names as your own code without worry. I'm curious if this namespace mechanism could, say, isolate monkey patches. Probably not, but it would be nifty.


Namespace isolates monkey patches.


>I'm curious if this namespace mechanism could, say, isolate monkey patches.

Wasn't that the purpose of refinements? Perhaps I am misremembering, because I never had a need to reach for refinements myself.


You still need to rely on the library maintainers to use them. This mechanism allows you to sandbox a library that doesn't.


Ok, understood. This being into account, would it not even better to make the most obvious way to code some logic most likely shaped without this issue in the first place.

Because, if the external dependency smells that bad, what the root cause? If that is crap code produced thus for some reason (unskilled/over-time-bound-pressured person for example), then probably this is better to avoid using this code altogether. And if this is instead because the language encourage easy path with bad outcomes, then it might make more sense to make a proposal with a facility to instead make the path of least resistance be something of more enjoyable outcome.


Proper namespaces are a good thing to have regardless. Relying on gem maintainers to not pollute the main namespace was always suboptimal.




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

Search: