I see [your] point. Perl 5 prototypes were invented mostly to make things like $x = pop @array work but there is nothing you can do with prototypes which you cannot do without them, only with different function call syntax.
In fact, prototypes are not even needed to restrict arguments types:
use Carp;
sub routine {
my ($array, $hash, $Xobj, $string) = @_;
croak "1st arg should be array ref" unless ref $array eq "ARRAY"; croak "2nd arg should be hash ref" unless ref $hash eq "HASH"; croak "3rd arg should be X object" unless ref $Xobj eq "X"; croak "4th arg should be a string" if ref $string;
# or shorter, less verbose: if (ref $array ne "ARRAY" or ref $hash ne "HASH" or ref $Xobj ne "X" or ref $string) { croak "Bad args to routine" }
# ... }
I would see this in a more positive light, perhaps, if prototypes were more
required for all functions, particularly if they offered named formal
parameters.
They will in Perl 6.
http://dev.perl.org/perl6/
Of course by "they will" I meant that they will offer named formal (and optionally typed) parameters, not that they will be mandatory.
-- ZSDC
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>