Re: new method question

2008-08-22 Thread John M. Dlugosz
Moritz Lenz moritz-at-casella.verplant.org |Perl 6| wrote: Attributes need to have a twigil, so it would be has $.name The syntax has $name; with no twigil is legal according to S12. Perhaps the original poster (Xiao Yafeng) might like to read

Re: new method question

2008-08-22 Thread Moritz Lenz
Xiao Yafeng wrote: > There are no barewords in Perl 6, but it seems new method is an exception: > > class Dog { > > has $name; Attributes need to have a twigil, so it would be has $.name > method bark () { > say $name; > } > } > my $p = Dog.new(

new method question

2008-08-22 Thread Xiao Yafeng
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');