Hi,
On 03/19/2015 12:40 AM, Tom Browder wrote:
I have a class with an attribute and a method with the same name and
it looks so far like they clash.
Attributes are always private. If you write 'has $.x', that generates
not only the attribute, but also an accessor method of name 'x'. See
also http://doc.perl6.org/language/objects#Attributes
So, you can have an attribute $!x and a method x, but if you write
class A {
has $.x;
method x() {... }
}
then the method will prevent the automatic accessor from being generated.
Cheers,
Moritz