On Sun, Oct 28, 2012 at 05:40:13PM +0100, Lukas Mai wrote: > On 27.10.2012 21:58, Peter Rabbitson wrote: > >On Sat, Oct 27, 2012 at 09:32:40AM -0400, Peter Martini wrote: > >>Just a couple of thoughts from my phone, which is why I cut out the message: > >> > >>1. Sub signatures have been prototyped, and quite successfully, on CPAN. > >>The internal interface could be improved, but the core support is there. > > > >This is simply untrue. There has never yet been an implementation on CPAN > >which concerned itself with the amount of arguments. > > This is simply untrue. :-) > Function::Parameters basically provides two modes of operation: > "lax" mode (the default), which works like 'my ($foo, $bar, $baz) = > @_;' (i.e. excess arguments are ignored, missing arguments are set > to undef), and "strict" mode, which croaks if the number of > arguments is wrong. > > The choice between the two modes lies with the subroutine author > because the checks are part of the generated code and controlled via > use/import arguments to Function::Parameters. > > >Nor has there been > >an implementation which in any way altered the behavior/contents of @_. > > Not 100% true. Function::Parameters can't make @_ disappear > completely, but it can alter the contents by automatically shifting > the first element into $self for methods. I suspect most modules of > this kind will do the "shift $self" thing, because it's really > extremely convenient for methods. (OK, that doesn't affect normal > 'sub' declarations - you have a point there.) > > >I never said keywords - I said syntax. Not only is your proposal adding > >new syntax *to the language core*, it does so by hijacking unused parts > >of a preexisting syntax (prototypes). No implementation on CPAN has > >attempted this so far. > > Isn't that exactly what signatures.pm does? It hijacks prototypes. > > Lukas I screwed up my original reply - there was too much context that remained only in my mind. Instead of saying: > There has never yet been an implementation on CPAN which concerned > itself with the amount of arguments. I meant to say > There has never yet been a successful (as in widely used akin to > Moose, or even better in conjunction with it) implementation on CPAN > which concerned itself with the amount of arguments at compile time. I hope this makes it clearer/more palatable CheersThread Previous | Thread Next