Skip Menu |

This queue is for tickets about the Role-Tiny CPAN distribution.

Report information
The Basics
Id: 88656
Status: resolved
Priority: 0/
Queue: Role-Tiny

People
Owner: Nobody in particular
Requestors: avar [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.003002
Fixed in: 1.003003



Subject: Role::Tiny shouldn't impose fatal warnings on its callers, should use non-fatal warnings like Moose::Role
The proper fix to this is going to be to document the behavior, not remove it.
Subject: Re: [rt.cpan.org #88656] Role::Tiny shouldn't impose fatal warnings on its callers, should use non-fatal warnings like Moose::Role
Date: Sat, 14 Sep 2013 00:32:30 +0200
To: bug-Role-Tiny [...] rt.cpan.org
From: Ævar Arnfjörð Bjarmason <avar [...] cpan.org>
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. Just tell me if you don't won't to take the patch so I can upload the wrapper I have for it I certainly wasn't expecting this non-Moose behavior, and I think it would be equally confusing to others, even if you document the bug. On Sep 13, 2013 10:10 PM, "Graham Knop via RT" <bug-Role-Tiny@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=88656 > > > The proper fix to this is going to be to document the behavior, not remove > it. >
Subject: Role::Tiny imposes fatal warnings on its callers without it being documented
On Fri Sep 13 18:32:43 2013, AVAR wrote: Show quoted text
> 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. > > Just tell me if you don't won't to take the patch so I can upload the > wrapper I have for it > > I certainly wasn't expecting this non-Moose behavior, and I think it would > be equally confusing to others, even if you document the bug.
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.
Subject: Re: [rt.cpan.org #88656] Role::Tiny imposes fatal warnings on its callers without it being documented
Date: Sat, 14 Sep 2013 08:56:17 -0700
To: Graham Knop via RT <bug-Role-Tiny [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Sat, Sep 14, 2013 at 10:56:43AM -0400, Graham Knop via RT wrote: Show quoted text
> 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.
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.
On Sat Sep 14 18:37:35 2013, AVAR wrote: Show quoted text
> I think there's multiple things wrong with it, in ascending order of > how relevant it is to the specific case of Role::Tiny:
The addition of strict+warnings to the caller's namespace was a feature of my code that Moose borrowed without discussion over whether it was actually correctly designed - same as lazy_build. In both cases, I spent a couple of years experimenting and came up with a refinement that, overall, I find an improvement - which are strictures and the "is => 'lazy'" attribute type respectively. I will happily admit that fatal warnings was a little on the irritating side to begin with but once I adjusted to having it on, I found that I was writing better code and overall ending up with less bugs and less time spent on debugging - in spite of the fact that it occasionally makes compiler errors less useful, which I'm well aware of. So, on the grounds that newbies will always use the defaults, and are generally best with as much protection as possible, I believe the current behaviour is preferable. I do however believe that we should document that should you want potentially broken code to run to completion rather than crashing, you can do: use Role::Tiny; use warnings NONFATAL => 'all'; so that people wanting the older behaviour for consistency with existing codebase can have it.
I've added a note to the documentation about it applying strict and fatal warnings, as well as how to disable them if desired.
Fixed in 1.003003. This may be addressed again in the future.
On 2014-03-25T10:20:22-04:00, haarg wrote: Show quoted text
> Fixed in 1.003003. This may be addressed again in the future.
Thought I'd re-open this to ask if now that Moo has decided to abolish the fatal warnings in 2.0 whether Role::Tiny has any plans to do that too now? 1. http://blogs.perl.org/users/graham_knop/2015/02/moo-20.html
On 2015-02-08T17:51:20-05:00, haarg wrote: Show quoted text
Ah cool, thanks. I didn't notice that, will update to the latest release and adjust some of my monkeypatches then. Thanks!
On 2015-02-08T17:51:20-05:00, haarg wrote: Show quoted text
Ah cool, thanks. I didn't notice that, will update to the latest release and adjust some of my monkeypatches then. Thanks!