What does this do? I have been over the related Apocalypse and Exegesis ( part 3 ) and I think the idea here is to allow myimport to be called with lists instead of arrays.sub myimport($exp_from : *@symbols=() : *@options=())
According to TheDamian in Exegesis 3, page 1, the @ will cause perl6 to expect either an array or an array reference as the parameter. If we were to declare a perl6 sub like this:
and called it like this:sub foo( @bar )
we would generate an error ( at compile time? ).&foo( "a", "b" );
If we really want foo to be called with a list, we need to put the flattening star in the sub definition:
sub foo( *@bar )
But, later on in the same tome, we are told that this will have the standard perl5 affect of slurping the remainder of the parameters.
I am guessing this to be an error on BrentDax's part. I believe BrentDax was attempting to allow myimport to be called with lists, but forgot that the flattening star would behave exactly as we expect from perl5. If I have missed something, I would really appreciate being corrected.
update: Changed a bit of wording in the last paragraph.
Mik
mikfire
In reply to Re: Poor Man's Perl6 Exegesis (you get what you pay for)
by mikfire
in thread Poor Man's Perl6 Exegesis (you get what you pay for)
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |