Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I finally got off my rear and started serious work on subroutine signatures. This now works:
use Sub::Signatures;
sub foo($bar) {
print "$bar\n";
}
sub foo($bar, $baz) {
print "$bar, $baz\n";
}
foo(1); # prints 1
foo(2,3); # prints 2, 3
foo(2,3,4); # fatal error
I capture the information necessary to do dispatch based upon typing, but the dispatch is currently only based on the number of arguments. Note that this works for subroutines and methods. Naturally, I have a TODO list:
Cool! (Score:1)
Re:Cool! (Score:2)
Thanks. I really hope it works as well as it appears to. I think I will have an alpha for the CPAN either tonight or tomorrow. I now have it set up to handle method dispatch "loosely" based on the number of args or a "string" mode where it dispatches on the number and type (ref) or args.
My tests for the latter:
How reliable is it? (Score:1)
Please just tell me it isn't based on source filters :-) Otherwise, it's not for me.
But if it is and you are actually willing to use a filter beast in production, take a look at reformed-perl [netalive.org], which mostly forestalls your effort (though it's mainly OO-centrically) and includes more doodads. I don't know how refined it really is, but collaboration or something is probably be better than independent developments.
Re:How reliable is it? (Score:2)
I found myself writing enough about source filters that I made a new journal entry to deal with this topic [perl.org].
As for reformed-perl, it looks interesting and solves some problems with Perl 5's OO, but it's doing far more than I had intended and I suspect people would be less likely to use my more modest approach if bundled with that code. Personally I'd just use something like Class::MethodMaker with Sub::Signatures and get most of the benefits. Of course, if they want to borrow my code, they can.
The fina