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

Junctions as arguments (Pugs bug)

4 views
Skip to first unread message

Ovid

unread,
Dec 19, 2006, 5:13:14 PM12/19/06
to perl6...@perl.org
Hi all,

use v6-alpha;

sub no_donut_for_you (Str $junction) {
state $count = 0;
$count++;
return $count;
}
say no_donut_for_you( any( 'a' .. 'd' ) );
no_donut_for_you( any( 'a' .. 'd' ) ).say;

That outputs something like the following on my system (Version: 6.2.13
(r14927))

any(VInt 1,VInt 2,VInt 3,VInt 4)
any(VRef <Scalar:0x2aa80e0>)

Taking out the final return or the state variable returns other strange
outputs.

Of course, that begs of the question of why I'm trying to cast a
junction as a string, but also, note that I'm not even using the
junction in the function. I discovered that by running the following,
which not only ran 8 tests, but also spewed garbage all over my screen.

use v6-alpha;
use Test;
plan 1;

is 'b', any('a' .. 'h'), 'junctions should work';

I'll happily commit tests, but what is the expected behavior of my
first code snippet?

(I see now that other junction tests use ok() instead)

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

0 new messages