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

Re: module loading built-in

Thread Previous
From:
Dan Book
Date:
September 3, 2021 16:56
Subject:
Re: module loading built-in
Message ID:
CABMkAVU-4pq9Jtv8y-bSJ8M6QKgh0UfHdCRyaU3EcG=14D75ww@mail.gmail.com
On Fri, Sep 3, 2021 at 12:49 PM Ricardo Signes <perl.p5p@rjbs.manxome.org>
wrote:

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

I think that would solve 95% of use cases that currently need
Module::Runtime (or a worse alternative). Name and return value to be
bikeshed notwithstanding.

-Dan

Thread Previous


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