develooper Front page | perl.perl5.porters | Postings from September 2022

Re: module loading built-in

Thread Previous | Thread Next
From:
Darren Duncan
Date:
September 17, 2022 00:56
Subject:
Re: module loading built-in
Message ID:
88b87c43-174f-e8f8-9f44-53d7a783c03b@darrenduncan.net
On 2022-09-16 5:50 p.m., Darren Duncan wrote:
> On 2022-09-16 7:44 a.m., Branislav Zahradník wrote:
>> IMHO better solution will be to provide namespace specific methods, eg:
>> Foo::Bar::->*is_loaded
>> Foo::Bar::->*load
>>
>> grammar rule:
>> NAMESPACE_LITERAL ARROW STAR method
>>
>> and so on
>>
>> 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?  If so, we probably want to look at such a feature more 
> holistically, not just for this use case.  I also recall discussions of 
> something similar, specifically adding Raku-like twigils to Perl, was rejected 
> in Corinna design discussions in respect to object attributes.  Also, how would 
> this proposed design work in situations where the package name is only known at 
> runtime, such as because it came from a configuration file? -- Darren Duncan

I feel the simplest solution is just alter the original RFC to be 
builtin::load($package_name) etc rather than unqualified "load".  That seems the 
most appropriate and simplest way to do this.  This is the kind of thing that 
builtin:: is for. -- Darren Duncan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About