2022-2-15 10:50 Yuki Kimoto <kimoto.yuki@gmail.com> wrote: > > 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. > > Additional Description: In this way, @_ can be suppressed because the definition of a signature is determined at compile time; Callbacks can receive the correct arguments. $cb->(splice @args, 0, $maxargs);Thread Previous | Thread Next