Don't ask to ask, just ask | |
PerlMonks |
Re: Namespace Pollutionby Necos (Friar) |
on May 06, 2003 at 22:52 UTC ( [id://256066]=note: print w/replies, xml ) | Need Help?? |
I personally feel that the user of a module should be able to choose whether or not to import functions into their namespace. What if someone writes a function called 32_bit_shift(), and I don't know about it, so I write a function with the same name. Which one gets called (I don't even know, because I try to pick names that won't be used)? Does perl generate an error? I've been lucky enough not to be bitten by conflicting function names. I guess no importing is one of the reasons to use OO. Then, even if you have conflicting function names, Perl takes care of which to call (you did bless your objects properly, didn't you?). The one thing that urks me is the libwin32 series of modules export a ton of constants without even asking me. It's a good thing that all of those constants are the same across modules (and consistently valued too), or there would be tons of problems. It's also a good thing that those constants are documented, or someone might create a constant that happens to step on another constant's feet. I think that's one thing you forgot to mention: documentation. A module user should be able to import what they want, and not be forced to take anything he (or she) doesn't want or need. I think it's nicer that way. Theodore Charles III Network Administrator Los Angeles Senior High email->secon_kun@hotmail.com perl -e "map{print++$_}split//,Mdbnr;"
In Section
Meditations
|
|