Apologies for being late to reply. On 16/07/2023 13:58, Ovid wrote: > > It would be nice to have some kind of pragma like: > > use feature 'use'; # rubbish name! > > And with that, none of your code could use a module that is not > explicitly used or required. A bit late to this, but maybe call the feature "strict_namespaces"? I am assuming that code should not refer to another namespace that has been explicitly used? > However, given string eval and other tricks, that might be hard to do. > So maybe: What about accessing things in another namespace with something like Package::Stash? What about packages like Getopt::Long::Descriptive or Data::Enum that create objects in ad hoc namespaces? Will this pragma prevent code from using those objects? What is I pass a reference to something in another namespace to code that uses this feature? I would still expect it to work. What about modules that use a a singleton, e.g. a state variable that is shared by everything that uses it? If modules are imported into isolated namespaces, will those singletons work?Thread Previous | Thread Next