On Fri, 3 Sept 2021, 17:49 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? > I'm confused. The core does provide this. It's called require/use in eval. I don't see what a builtin would add. > 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. > eval "use $module; 1" Works fine. > > 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. > Weird. In all 20 years I've been hacking perl I don't think I ever wanted to do that even once. YvesThread Previous | Thread Next