Rakudo and I have a disagreement over this: I expect to be able to
assign to a $.foo attribute in methods within the class, whereas
Rakudo demands the "is rw" attribute in order to do that.

We discussed it a bit on #perl6 today.

 <http://irclog.perlgeek.de/perl6/2008-09-17#i_572836>

I only have pragmatic arguments to offer for my point of view:
somehow, it feels like each and every attribute gets an "is rw" as
things stand now. The modifier somewhat loses its meaning... if it
meant "_publicly_ readable/writable", it would only be used for some
variables.

(I may have to rethink the above reason when attribute initialization
(as in "has $.foo = 5") is fully implemented in Rakudo.)

The other argument is that I (for some reason) expect a $.foo variable
to be changeable from within the class -- even when it doesn't have an
"is rw" attribute. It's one of those presuppositions which keeps
biting me when writing classes. I know I could use "$!foo"
consistently, and things will work, but... then I have to remember to
write "$.foo" when declaring the variable and "$!foo" when using it.

Finally, some useless statistics: I count 12 attributes in different
classes in November right now. Out of those, 12 (100%) have the "is
rw" attribute.

// Carl

Reply via email to