From: "Ara.T.Howard said:
i'm unclear how this whole construct is more useful that using modules as
namespaces, which can be nested and manipulated like all other module/classes.
There's only one reason I've been eagerly awaiting selector namespaces,
and it was that I thought it meant we would be able to, in our own
modules (or namespaces) be able to redefine core methods, and have
these changes be in effect only within our own namespace.
I was imagining something like:
namespace foo
require 'mathn' # without changing mathn source
p 5/9 # => 5/9
end
p 5/9 # => 0
I.e. by defining and working in a namespace, you'd be insulating
the rest of Ruby from changes made within that namespace,
particularly overriding core class' methods.
I guess with the proposed scheme, it would be,
require 'mathn' # presuming mathn changed to use namespaces
using mathn
p 5/9 # => 5/9
stopusing mathn
p 5/9 # => 0
???
Is it true that with the proposed approach, the source code of
mathn would have to be changed to make it define its methods
explicitly within a namespace? Is there no way to 'require'
a module into a namespace without having to change the module's
source code?
Regards,
Bill