Subject: | Wishlist: method keyword takes effect at runtime |
Date: | Thu, 29 Aug 2013 14:17:21 +0000 |
To: | bugs-Function-Parameters [...] rt.cpan.org |
From: | Matt S Trout <mst [...] shadowcat.co.uk> |
15:01 <@mauke> sub method {} # you're screwed
15:01 <@mst> well, yes, that's why Method::Signatures::Simple (for example) only installs it at runtime
15:01 -!- bluescreen [~mariano@151.193.220.27] has joined #p5p
15:01 <@mst> the only example I can think of that lifts it to compile time is schwern's, because I couldn't get him to understand that that broke things
15:02 <@ilmari_> the only reason to define methods at compile time is so that you can consume roles that require them before defining them
15:02 <@mauke> what does it break?
15:03 -!- bluescreen [~mariano@151.193.220.27] has quit [Remote host closed the connection]
15:03 -!- bluescreen_ [~mariano@151.193.220.27] has joined #p5p
15:03 <@mst> mauke: things like 'method has' become a disaster
15:04 <@mst> mauke: 'sub' being compile time really isn't a feature for modules
15:04 <@mauke> how common is this?
15:04 <@mauke> I mean, there's a trivial workaround: *has = method ($thing) { ... };
15:05 <@mst> yes. but not having to use the ugly workaround is one of the reasons I use Method::Signatures::Simple sometimes
15:05 <@mst> in fact, it's why I uploaded that module at all
15:06 <@mst> when Method::Signatures switched to compile time installation it was no longer interesting to me
15:06 <@mst> fixing the precedence order annoyances of 'sub' actually turned out to be just as important to me as signatures themselves
15:07 <@ilmari_> s/for modules/for classes/ # I think
15:08 <@ilmari_> otherwise Sub::StrictDecl would only work for imported subs
15:08 <@mst> I was under the impression that Function::Parameters made 'fun' compile time for consistency with 'sub', and 'method' run time for consistency with every other method keyword
15:08 <@mauke> no, F:P is always compile time
15:08 <+purl> okay, mauke.
15:08 <@mst> mauke: any chance of an import() option to fix that?
15:09 <@mauke> I didn't know the runtimeness was supposed to be a feature
15:09 <@mauke> mst: I'm currently looking at how Sub::Name works
15:09 <@mauke> mst: feel free to report a wishlist bug so I don't forget about it
--
Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue
http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/
Email me now on mst (at) shadowcat.co.uk and let's chat about how our CPAN
commercial support, training and consultancy packages could help your team.