Ls,
Following piece of code gets an error when calling $b.get-t0.
---
#!/usr/bin/env perl6
#
use v6;
role A {
has $!t0;
method get-t0 ( ) {
return self!get-t0-helper;
}
method !get-t0-helper ( ) {
my $t0 = $!t0 // 'T0';
}
}
class B does A { }
my $a = A.new;
say "A: ", $a.get-t0;
my $b = B.new;
say "B: ", $b.get-t0;
---
The output and error is;
Attr: Int $!t0
A: T0
Attr: Int $!t0
P6opaque: no such attribute '$!t0'
in method get-t0-helper at class3.pl6:14
in method get-t0 at class3.pl6:9
in block <unit> at class3.pl6:25
The strange thing is when you call self.^attributes in the helper method
the name is printed as shown in the output. The error disappears after
removing the hide(!) operator.
Perl version;
This is perl6 version 2015.04-5-g59f57a8 built on MoarVM version
2015.04-3-gbb50941
Greetings,
Marcel