4 ms·
What's the difference between FooBar::Record and ns1::Record? Nothing, except the latter pushes encapsulation onto the user. This is not the Ruby ethos.
by ezekg 1y ago
What's the difference between FooBar::Record and ns1::Record? Nothing, except the latter pushes encapsulation onto the user.
This is not the Ruby ethos.
- usrbinenv 1y agoOn a purely syntactic level snake_case gives me a clear indication this is something different (not a module). But the underlying mechanics of how namespaces would work, as I've mentioned in another comment, is that the choice of picking namespace identifiers is shifted to users of gems/libraries. I think the proposal might further benefit from maybe giving libraries default namespaces and, for example, Go does exactly this: you can import a package with the namespace prefix defined by package author, but you can also change it or import it without a namespace prefix at all.
- ljm 1y agoRealistically it would be FooBar::Record and ns1::FooBar::Record too, unless gems start replacing their top level module FooBar with FooBar = Namespace.new. And why would you bother doing that when it would be a breaking change?