(defun make-para ( content &key alignment font size color ) ...)
The point here is that the first argument is dealt with positionally,
and subsequent, optional args are dealth with as keyword arguments. It
seems to me that similar functionality might sit well with Perl 6, but
I'm not sure I can think of a good declaration syntax. Calling syntax
is easy:
make_para $text, font => 'Helvetica,Arial,Whatever';
Any thoughts?
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?
sub mysub(String $content; int $key, int $align)
{
...
}
sub callmysub
{
mysub("Testing .. 1, 2, 3!"; key => 1024, align => Module::RIGHT);
}
Which, upon reflection, apparently introduces an "implicit hashparsing"
context for autoquoting hashkeys.
=Austin
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
Sure. It already does that. But only if the caller feels like it.
If you can remember the order of all those arguments, great, but if
you can't, you can use keywords.
sub make_para($text; $alignment, $font, $size, $color) {...}
Can be called in a lot of ways, one of which you wrote above.
I sure hope it doesn't complain that you didn't specify alignment. I
guess that's what exists() is for.
Luke
> sub callmysub
> {
> mysub("Testing .. 1, 2, 3!"; key => 1024, align => Module::RIGHT);
> }
>
> Which, upon reflection, apparently introduces an "implicit hashparsing"
> context for autoquoting hashkeys.
Those are pairs, aren't they?
--
Paul Johnson - pa...@pjcj.net
http://www.pjcj.net
> Austin Hastings said:
>
>> sub callmysub
>> {
>> mysub("Testing .. 1, 2, 3!"; key => 1024, align => Module::RIGHT);
>> }
>>
>> Which, upon reflection, apparently introduces an "implicit hashparsing"
>> context for autoquoting hashkeys.
>
> Those are pairs, aren't they?
Yup.