Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need correction to S06

1 view
Skip to first unread message

Yiyi Hu

unread,
Aug 22, 2005, 6:05:06 AM8/22/05
to perl6-l...@perl.org
svnbot6 r6401 | iblech++ | *%slurpy_hashes exist :)
svnbot6 r6401 | iblech++ | It uses the semantics of
svnbot6 r6401 | iblech++ |
http://www.nntp.perl.org/group/perl.perl6.language/22860, i.e.
svnbot6 r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash =>
{...}); # works
svnbot6 r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash =>
{...}, foo => bar); # dies


in S06
List parameters section
sub duplicate($n, *%flag, *@data) {...}
duplicate(3, reverse => 1, collate => 0, 2, 3, 5, 7, 11, 14);
duplicate(3, :reverse, :collate(0), 2, 3, 5, 7, 11, 14); # same

Should the example changed to?
sub duplicate($n, *%flag, *@data) {...}
duplicate(3, flag => { reverse => 1, collate => 0 }, 2, 3, 5, 7, 11, 14);
duplicate(3, flag => { :reverse, :collate(0) }, 2, 3, 5, 7, 11, 14); # same

duplicate(3, flag => { reverse => 1 }, collate => 0, 2, 3, 5, 7, 11,
14); #error
duplicate(3, flag => { :reverse }, :collate(0), 2, 3, 5, 7, 11 ); # error.


Otherwise, I might confuse many newbie just like I do.

Thanks,
Xinming

Larry Wall

unread,
Aug 22, 2005, 11:51:49 AM8/22/05
to perl6-l...@perl.org
On Mon, Aug 22, 2005 at 06:05:06PM +0800, Yiyi Hu wrote:
: svnbot6 r6401 | iblech++ | *%slurpy_hashes exist :)

I think the simplest thing is to say that you can't bind to the name
of the slurpy hash. You give a name to it so that you can refer to it
inside, but that name is not visible to binding. (We could probably
say the same thing for other slurpy types, I suspect--especially if
it would simplify the binding code.)

Larry

Luke Palmer

unread,
Aug 22, 2005, 12:18:56 PM8/22/05
to perl6-l...@perl.org
On 8/22/05, Larry Wall <la...@wall.org> wrote:
> I think the simplest thing is to say that you can't bind to the name
> of the slurpy hash. You give a name to it so that you can refer to it
> inside, but that name is not visible to binding.

Fixed in https://svn.perl.org/perl6/doc. Thanks.

Luke

0 new messages