3 ms·
Why is there no work on a synonym to sub { } with parameter declarations, preferably like Perl 6? I guess the answer will be: "At least join the 20th century,
by berntb 16y ago
Why is there no work on a synonym to sub { } with parameter declarations, preferably like Perl 6?
I guess the answer will be: "At least join the 20th century, MooseX::Declare is old. Almost 2 years!"? :-)
Another thing: Changing precedence for parameter parsing (functions with prototypes) -- won't that kneecap a lot of old code?!
- phaylon 16y agoMooseX-Declare is a bit more than that. If you simply want signatures, take a look at Function::Parameters (for functions) or Method::Signatures::Simple (for methods with an invocant).
- draegtun 16y agoAnd also (and definitely not last!) there is Method::Signatures (http://search.cpan.org/dist/Method-Signatures/ http://search.cpan.org/dist/Method-Signatures/) which adds both function & method signatures.
- draegtun 16y agoChanging precedence for parameter parsing (functions with prototypes) -- won't that kneecap a lot of old code?! Hopefully not. Its a bug fix so anyone using unary functions with protoypes may have noticed that it didn't always work correctly before (touch wood!). * http://search.cpan.org/~shay/perl-5.13.5/pod/perl5134delta.pod#Change_in_the_parsing_of_certain_prototypes http://search.cpan.org/~shay/perl-5.13.5/pod/perl5134delta.p... * http://groups.google.com.cy/group/perl.perl5.porters/browse_thread/thread/398f075aef290e06/2af61879a326f935 http://groups.google.com.cy/group/perl.perl5.porters/browse_...
- mst 16y agoBecause 'use signatures','use Function::Signatures','use Method::Signature::Simple' and 'use MooseX::Method::Signatures' all exist, and work well, but the CPAN cage match still continues for the One True Way. And since that effectively means that adding it into core would merely be an optimisation, it's preferred to wait until a standard has been settled upon so we don't end up having to maintain compatibility with something people have since discovered is a bad idea. The keyword parsing hooks added for version 12 make adding new keywords to experiment even easier, as well - so I think you can expect some signature form to go into core by v16 at the latest (2012), with the advantage that because the current solutions are CPAN modules your code using signatures of one of those sorts today won't break if/when that happens. edit: and as for chromatic's tweet, this is not "apologetics for lack of a feature", this is a personal explanation of why I haven't attempted to write a patch for this yet, but will be seriously considering doing so at some point unless somebody else gets there first. And as schwern points out, there's movement towards a unified syntax for invoking such things that we can quite possibly repurpose later.
- schwern 16y agohttp://github.com/schwern/Perl-Signatures-Common http://github.com/schwern/Perl-Signatures-Common FIGHT!
- mst 16y agoFrom @chromatic_x: "@shadowcat_mst I use the word "apologetics" in its medieval sense of "a rigorous defense" not "an excuse"." So, ok, then it was apologetics for lack of a feature. Also, my english is apparently insufficient, and I've only discovered this after the edit has timed out. As the child of two english literature graduates, I am now going to crawl into a corner and turn bright red for a few minutes. Sorry.