develooper Front page | perl.perl5.porters | Postings from February 2022

Re: arity checking (was Re: PSC #049 2022-01-07)

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
February 15, 2022 01:50
Subject:
Re: arity checking (was Re: PSC #049 2022-01-07)
Message ID:
CAExogxO0Eb79zVH9t85di3H5kXba6V9Ob_VArSFw5ar1qu3fwA@mail.gmail.com
2022-2-15 2:12 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

>
>   my ( $minargs, $maxargs ) = builtin::sub_arity $method;
>   $self->die( "Too few arguments for .$d directive" )  if 1+@args <
> $minargs;
>   $self->die( "Too many arguments for .$d directive" ) if 1+@args >
> $minargs;
>
>   return $self->$method( @args );
>
> Perl currently does not provide this. So I can't.
>
>
If  signatures enable arity checking, there is a strong need for the API to
get the minimum and maximum number of arguments.

This is because generally speaking, module authors know the details of Perl
language, but module users don't know the details.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About