Aaron Sherman asked:

> > >     sub get_bar() { .bar }
> > >     sub get_baz() { .baz }
> > >     sub set_baz($newbaz) { .baz = $newbaz }
> >
> >
> > Close. They'd probably be implemented like this:
> >
> >       method get_bar() { $.bar }
> >       method get_baz() { $.baz }
> >       method set_baz($newbaz) { $.baz = $newbaz }
> 
> Wouldn't those be the same?

Not quite. C<$.bar> is a direct access to the attribute. C<.bar> is a call
to the accessor. There might well be performance issues.

> ".bar" is the auto-created accessor for
> "$.bar", so they should do the same thing, no?

Presumably, but perhaps not quite as fast.


> And in the case of ".baz", I'm assuming that a public member will be
> given an "is rw" accessor, so that ".baz = $newbaz" will work the same
> as "$.baz = $newbaz".

That would be the plan, yes.

Damian

Reply via email to