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]
- RFC 97 (v1) prototype-based method overloading Perl6 RFC Librarian
- Re: RFC 97 (v1) prototype-based method overloadin... Jonathan Scott Duff
- Re: RFC 97 (v1) prototype-based method overloadin... Ask Bjoern Hansen
- Re: RFC 97 (v1) prototype-based method overlo... Chaim Frenkel
- Re: RFC 97 (v1) prototype-based method ov... Piers Cawley
- Re: RFC 97 (v1) prototype-based metho... Chaim Frenkel
- Re: RFC 97 (v1) prototype-based ... Peter Buckingham
- Re: RFC 97 (v1) prototype-ba... Nick Ing-Simmons
- Re: RFC 97 (v1) prototype-based method ov... Damian Conway
- Re: RFC 97 (v1) prototype-based metho... Piers Cawley
- Re: RFC 97 (v1) prototype-based method overloadin... Nick Ing-Simmons
- Re: RFC 97 (v1) prototype-based method overlo... Graham Barr
