On 2013-09-14T11:56:30-04:00, ETHER wrote:
Show quoted text> On Sat, Sep 14, 2013 at 10:56:43AM -0400, Graham Knop via RT wrote:
> > On Fri Sep 13 18:32:43 2013, AVAR wrote:
> > > Sure, I can also just solve this myself by uploading a
> > > Mooselike::Role::Tiny wrapper.
> > >
> > > But I don't get why you don't just conform to the Moose behavior in
> > > this
> > > regard like in other regards.
> >
> > It isn't a bug; it's the intended behavior. I'm not going to apply
> > the patch, but I will add a note in the docs about this. Applying
> > strict/warnings isn't mentioned at all currently, and it clearly
> > should be.
>
> Avar, can you explain why this behaviour is a problem for you?
> (perhaps
> including a reproduction case where it causes inconvenience?)
>
> My understanding is that since Role::Tiny doesn't pull in any non-core
> deps, fatalizing warnings within its scope is not unreasonable, as any
> warnings occuring here would be quite surprising and undesired.
I think there's multiple things wrong with it, in ascending order of
how relevant it is to the specific case of Role::Tiny:
* Even if for some reason you think dying on warnings is the way to
go 'use warnings FATAL => "all"' actually sucks for that
purpose. As explained more exhaustively than I could by Tom
Christiansen in
http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169396.html
it actually ends up hiding actual issues in your code, i.e. you'll
often times get some nonsensical warning before the compiler would
have died with a sensible error message anyway.
* "use strict/warnings" is actually a sane default, "use warnings
FATAL => 'all'" is not.
In practice it's pretty hard to unknowingly write code that doesn't
pass "use strict", you declare your variables, don't use bareword
subs or screw with the symbol table etc. It's basically a small set
of perl 4-isms. I can't remember the last time I had to turn of
strict where I wasn't doing "no strict 'refs'" to write something
like an exporter.
Something that does "use warnings" then opts you in to *knowing*
about *potential* issues in your code, which brings me to my next
point:
* It stupidly squashes what are two levels of reporting built into
perl into one level of reporting.
Perl dies on *serious* issues, and warns about less serious ones
you may want to look at. when you turn on FATAL warnings the
severity of those two becomes indistinguishable.
* It's not something you expect from a "Moose-like" module. Even if
it's noted somewhere in the docs that FATAL warnings are turned on
by Role::Tiny a lot of people will just continue to assume that it
gives them what Moose::Role gives them, and be bitten by things
unexpectedly dying on them.
I actually encountered this because I was writing a role that used
30-something modules, and when your code dies on a warning you now
in the best case scenario have to go and look at the docs for those
30-something modules to see who's being clever about importing
FATAL warnings at a distance.
Most code I've seen, including on the CPAN, uses strict/warnings
anyway, most code does *not* use FATAL warnings. So by having
Role::Tiny sneak in fatal warnings at a distance you're sneaking in
behavior changes users probably aren't expecting.
* That's above all what I think is silly about this. Not importing
FATAL warnings works just fine for Moose::Role, why not just have
Role::Tiny (claiming to be a "size slice of Moose") follow suit?
I think it's fairly safe to say that people who subscribe to the
idea of FATAL warnings are using them anyway, either explicitly or
via strictures.pm or something. It makes for obvious and easily
readable code if people just use that, not if random utility
modules like Role::Tiny import uncommon pragmas.