Now for variables that should not be seen outside of the module, we have my. If you wanted to hide a function, you could use a local function reference instead.
But what about packages? In C++ an anonymous namespace will localize anything to the current translation unit (source file), including class names. In Perl, a package pretty much has to have an actual name. That is, it can't be a local reference to an unnamed object (e.g. what Symbol::gensym does). I suppose the normal way of doing this is by assuming that if I named my module Foo, than no other module named Foo exists, and Foo::x, Foo::y, etc. are all OK. Big comments say that those internal namespaces are, well, internal (e.g. see documentation for Carp::Heavy). If more than one developer or a distributed team is working on the same module, then you still have to be careful about conflicts, and perhaps use an internal naming convention.
But, is there a better way? Are there any other ways, really? Is there anything proposed for Perl 6 that will better hide internal details from other code?
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Hiding Internal Classes ?
by tye (Sage) on Jul 11, 2001 at 00:05 UTC | |
|
Re (tilly) 1: Hiding Internal Classes ?
by tilly (Archbishop) on Jul 11, 2001 at 01:46 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 02:00 UTC | |
by tilly (Archbishop) on Jul 11, 2001 at 06:28 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 10:11 UTC | |
|
Re: Hiding Internal Classes ?
by bikeNomad (Priest) on Jul 11, 2001 at 03:25 UTC | |
|
Re: Hiding Internal Classes ?
by Anonymous Monk on Jul 10, 2001 at 23:09 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 01:09 UTC | |
by tye (Sage) on Jul 11, 2001 at 01:46 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 01:55 UTC | |
by tye (Sage) on Jul 11, 2001 at 01:58 UTC | |
|