> > Advantage: > > - namespace methods will not pollute namespace for other methods > > - namespace methods will always be prefixed with * > > Is this a situation where we want to start having special syntax for particular > method calls? these are no ordinary methods, these are methods invoked on internal data. It's similar to My::Class::->meta->..., but instead of having meta method (polluting user's namespace) it will signal that this is internal method. As far as Perl doesn't distinguish between namespace and instance of namespace special syntax is needed. Either non-OOP (using builtin) or this prefixed. Having * prefix is cheap (from implementation of grammar) and yet it provides reading hints, eg: Module::Foo::->*load; Module::Foo::->load; Executing following on metacpan-cpan-extracted: ack -l 'sub load\b' | fgrep -v 'Module::Install' | wc -l 5546 There are more questions about this, a few: - do you want to be more OOP friendly ? - do you want to support only `load $module` or something else as well? - do you want to support per-namespace overload? - do you want another module methods - related by not part of `load` -> anonymous namespaces # OOP: There are many other operations one would like to execute on namespace, eg (Moose): Module::Foo::->meta->add_method Module::Foo::->meta->get_method_list do you want all of them in builtin namespace? # load something else: in case it will reside in builtin, it should say what it should load (and how) Examples for module: builtin::load_module (Foo::); builtin::load_module (Foo::, dies => 0); # returns true/false instead, yet still populating $@) # per-namespace overload Makes no sense for `'load_module` but may for others, eg (showing intention, no real implementation): package Foo { sub AUTOLOAD { ... } sub * get_method_list { qw[ foo bar baz ]; } } I already wrote pre-rfc about namespace literals, see "Pre-RFC: namespace literal as first class citizen" (sent 2022-06-30) BranoThread Previous | Thread Next