Re: Proposed feature: die on compile with undefined functions

[email protected] (Michael Conrad)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On 2/4/26 12:06 AM, Evan Carroll wrote:
> Consider Foo:: will die if the package Foo doesn't exist at compile time.
>
> We could do `::->` which preserves that characteristic and resolves 
> the function name strictly too..
>
> # Checks for namespace Foo with function bar in compile time.
> Foo::->bar(1,2);
> # Checks for namespace Foo with function bar in compile time, without 
> symbol resolution on Foo.
> "Foo"::->bar(1,2);

I don't really understand how this relates to his proposal... he wanted 
a flag to assert that un-qualified functions like "max(...)" were 
defined in scope at compile time, which would include lexical subs in 
addition to current-package subs.  I also suspect the goal was to not 
need to bulk up the code with defensive constructs, and just get to use 
the language like normal with an extra layer of strictness.

Sub::StrictDecl can do it, so the only question is whether it can be 
done better (allowing subs in the same file to be used out-of-order) and 
whether it could/should be available as a core feature.

-Mike C.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.