On Mon, Aug 14, 2000 at 04:17:51PM -0000, Perl6 RFC Librarian wrote:
> =head1 SUMMARY
> 
>       $frog_t = qs(frog);
>       sub listargs($){ print "One arg, $_[0]"}
>       sub listargs($$){ print "Two args, $_[0] and $[1]"}
>       sub listargs($$frog_t){ print "$_[0] and a frog $[1]"}
>       sub listargs { throw argsyntax, "odd arguments to listargs" }
> 
>       my frog $k = new frog(type=>tree);
>       listargs("franz","tree");       # prints "Two args..."
>       listargs("franz",$k);           # prints "franz and ..."
>       listargs($k,"franz");           # throws an argsyntax error

Perl can't distinguish that last one as an error since it matches the
prototype for 

        sub listargs($$) { ... }

unless you somehow include strong typing in your RFC.  Right now, $
means "I need a scalar, any scalar".

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to