There are no barewords in Perl 6, but it seems new method is an exception:
class Dog {
has $name;
method bark () {
say $name;
}
}
my $p = Dog.new($name => 'boo');
$p.bark; #error!
my $p = Dog.new( name => 'boo');
$p.bark #say boo
more confused:
class Dog {
has @names;
method bark () {
say @names;
}
}
my $p = Dog.new(names => 'boo');
$p.bark; #nothing but passed.
So, how set array attribute of a class by new method?
