$new
would effentially be the same as your card.
use v6;
my @deck = True, False;
my $card = @deck.pick;
say "your card is $card";
for ^5 {
say @deck.pick
}
your card is True
False
True
False
True
True
]]>
Long story: the feature was implemented using a subclass of Int, basically:
class Index is Int { method Bool { self.defined } }
Coercing an Int to an Index would work, but coercing an Index into an Int shouldn't (as it was already an Int). I made that work, however, but that was really against expectations (well, not mine, obviously).
Anyways, we're most likely going to have another way of handling the
if "foo".index("f") -> $pos { say $pos }
gotcha in another way.
http:/github.com/rakudo/rakudo/blob/a190b23bf9d81d84670a36ad448280ec8941144e/src/core/Proc.pm#L127
]]>.index($substr).defined
is now called .contains($substr)
. With that, the entire loop body becomes just
.say if .contains($string) && .words[1] != $*PID
]]>
.index
now returns an Index value, which is just like an Int except it is only false when it is undefined. So you can just say
.say if .index($string) && .words[1] != $*PID
]]>
Determining cause of action now...
]]>for
loop has 3 levels of signature unpacking. You don't see the first one which is implicit.