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

module loading built-in

Thread Next
From:
Ricardo Signes
Date:
September 3, 2021 16:49
Subject:
module loading built-in
Message ID:
1de9616e-4f6c-40ef-b049-ec270fba9f77@beta.fastmail.com
Porters,

For unexciting reasons, Module::Runtime has come up a few times on recent PSC calls.  We talked about Module::Runtime, Class::Load, and I don't know how many other related topics.

We ended up with this question:  Isn't this something the core should provide?

Now, I'm not saying the core should provide every single thing provided by all the modules in this problem area.  I'm saying that maybe 99% of use of these libraries would be addressed by providing one or two small concessions in the core language.  I don't know what the second concession of that one or two is, but I know the first one is acknowledging that the current behavior of "require EXPR" isn't as useful as it could be.  When given a string, it's much more common to want to load a module, not a file.

So, let's say we were to implement a new require-like builtin that we wanted to be a core language feature and live forever.  Would it be something other than something really close to Module::Runtime's use_module?  I have some thoughts, but I think the basic question here is: 

Is it enough to say "v5.x will provide `load`, which will take a module name and optional version, then load that module (or die trying) and call ->VERSION on it.

-- 
rjbs
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