I think that's literally impossible. If you require two features that both have Command classes, there's no possibility of resolution.
I would recommend:
require 'Mycompany/Net/Pop'
include Mycompany::Net::Pop
Then Command will be part of the current namespace.
-- David Black
I think that's literally impossible. If you require two features that both have Command classes, there's no possibility of resolution.
Not Really. Conflicts can be handled by using fully qualified name. Anyway how can using include help this.
-- rolo [Rohit Lodha]
Consider this:
require 'A/B/C'
require 'D/E/C'
What is C.new at this point? And does it change, depending on the order? Or depending on whether you rewrite the code and remove something?
As for include... what it does is eliminate the need to use the fully-qualified path. That was your goal, wasn't it? :-)
-- David Black
It's also possible to do this with simple assignment, since modules are simply objects.
require 'Mycompany/Net/Pop'
cmd = Mycompany::Net::Pop::Commands
headers = cmd.top
This way, you can even have David's example:
require 'A/B/C'
require 'D/E/C'
abc = A::B::C
dec = D::E::C
-austin
I think that's literally impossible. If you require two features that both have Command classes, there's no possibility of resolution.
I would recommend:
Then Command will be part of the current namespace.
-- David Black
I think that's literally impossible. If you require two features that both have Command classes, there's no possibility of resolution.
Not Really. Conflicts can be handled by using fully qualified name. Anyway how can using include help this.
-- rolo [Rohit Lodha]
Consider this:
What is C.new at this point? And does it change, depending on the order? Or depending on whether you rewrite the code and remove something?As for include... what it does is eliminate the need to use the fully-qualified path. That was your goal, wasn't it? :-)
-- David Black
It's also possible to do this with simple assignment, since modules are simply objects.
This way, you can even have David's example:
-austin