David Storrs wrote:
On Thu, Mar 10, 2005 at 02:22:20PM -0600, Rod Adams wrote:The question is not what they import. The question is what they export into your package. If it's not exported into your package, the other multi's are in a different package, and get a different short name. I see the short name as including the package name for subs, class name for methods. Only the signature is chopped off.
David Storrs wrote:
On Wed, Mar 09, 2005 at 03:38:52PM -0600, Rod Adams wrote:Well, if you were not expecting Foo to export some &bar's, then you're in for a surprise regardless of dispatch when you call &bar in your code and one of Foo::bar gets called instead of one of yours, because it was a closer match.
This seems like action-at-a-distance to me;use Foo; # from above, exports &bar is MMD::Random multi sub bar {...}
Does this generate an error, since one could expect this particular &bar to be Manhattan? Or does it assume Random, since there's already a &bar in existence?
I would say that people should know what they are getting into when they C< use > something.
What I'm hearing you say here is "Yes, it's action-at-a-distance, but it's your job to make sure it doesn't trip you up." The problem that I see is that I may well be able to keep track of everything from the modules I import, but what about the ones THEY import...and the ones THEY import...and so on. In a medium-to-large software project, that can get to be a lot of modules, very quickly.
I'm only asking you to keep track of what gets imported into your current package, which I do not think is asking for too much, even in a large scale project. Whatever your used modules have in their packages which they keep to themselves, including everything _they_ imported from _other_ modules, is not your concern... that's a different package space.
If you go pumping new multi's into someone else's package by saying C< multi sub Foo::Bar {...} >, well, you better be familiar with what's already there.
So, it could be considered action at a distance, but feels more like keeping track of what you've asked others to dump in your lap.
-- Rod Adams