You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected this wouldn't work because the attribute definition is parsed at
compile time when $!x and $!y aren't known. The error is definitely LTA.
You can do what you want like this:
class rect {
has $.x;
has $.y;
has Array $.area .= new(:shape($!x,$!y))
}
say rect.new(x => 3,y => 4).area.shape[1] #-> 4
$.area has to be a $ attribute because @ will do array assignment which
will lose the shape of the RHS array (and we are not able to do := in the
default for attributes atm).
LL
On Mon, Feb 20, 2017 at 8:19 AM Neven Luetic <perl6-bugs-followup@perl.org>
wrote:
Migrated from rt.perl.org#130817 (status was 'open')
Searchable as RT130817$
The text was updated successfully, but these errors were encountered: