What prevent warnings pragma become default feature?
What prevent warnings pragma become default feature by use VERSION?
In Perl 5.12, strict pragma become default feature by use VERSION .
use v5.12; # enable strict pragma
Now many source code examples in web is written by the following way.
use v5.x; use warnings;
If warnings is enabled by use VERSION, it is useful.
Nothing against it, because most code will use warnings.
But sometimes it is necessary to turn it off, e.g.
In short, warnings::register prevents it. In other words you aren't sure about the set of warnings that are going to be enabled implicitly.
Let me add that warnings are often used to detected edge conditions in the program environment (input etc.) while strictures control the program syntax and data flow, so enabling warnings by default everywhere might cause unwanted problems, even if it's generally a good coding practice. (This is also why using fatal warnings in production is an absolute no-go.)
Helmut Wollmersdorfer
>But sometimes it is necessary to turn it off, e.g.
Is this resolve "no warnings"?
>In short, warnings::register prevents it. In other words you aren't sure about the set of warnings that are going to be enabled implicitly.
That is true. But if we don't need warnings, we can do "no warnings". It is good that warnings is default.
>so enabling warnings by default everywhere might cause unwanted problems.
No, No. What I say is that "use VERSION" enable warnings pragma by default.
It have no effect to users who don't use use VERSION.
I suspect retro cvompatibility is the issue. If you enable warnings on default you nave to refactor old code to USS no warnings.
fluca1978
>I suspect retro cvompatibility is the issue. If you enable warnings on default you nave to refactor old code to USS no warnings.
No, No, I insist that "use VERSION" enable warnings pragma by default. retro compatibility is no matter.
If retro compatibility is not an issue, I suspect that Perl developers would have already enabled warnings by default.
On the same line of thoughts, why is not "my" a default for variables?
Why not automatically using a predefined set of modules without having to specify "use"?
The language has been built and evolved in a specific way, so while we can change the future, we cannot destroy the past.