Re: RFC 57 (v1) Subroutine prototypes and parameters

[email protected] (Jonathan Scott Duff) Mon, 7 Aug 2000 10:04:43 -0500
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
On Mon, Aug 07, 2000 at 02:35:50PM -0000, Perl6 RFC Librarian wrote:
>     sub foo ($x, $y) {
>         ...
>     }
> 
> This would be equivalent to the Perl 5 construct:
> 
>     sub foo ($$) {
> 	my ($x, $y) = @_;
>     }

This and 

> Default values could also be provided in subroutine prototypes.
> 
>     sub wiz ($first, $second, $third = 5, $fourth = 7) {
> 	...
>     }

this, yes.

The rest, I'm not so sure about.

> or instead with named parameters.  But how exactly?  One candidate for
> the calling convention would be:
> 
>     # common Perl 5 form, '=>' implies LHS is quoted
>     foo(x => 10, y => 20);

Just thinking out loud ...

foo(	$x:10,		$y:20		);
foo(	[ x => 10 ],	[ y => 20 ]	);
foo(	{ x => 10, y => 20 }		);
foo(	$x'10,		$y'20		);	# Gone are the days of perl4
foo(	$x|10,		$y|20		);

-Scott
-- 
Jonathan Scott Duff
[email protected]