Re: Thinking about Accessors

2004-02-29 Thread Larry Wall
On Sun, Feb 29, 2004 at 01:44:47PM -0500, Aaron Sherman wrote: : On Fri, 2004-02-27 at 21:57, Luke Palmer wrote: : : > method bar_attr() will get { $.bar_attr } : > will set { $.bar_attr = $_ } : : I'm confused by this in only one way... since method bar_attr and the : a

Re: Thinking about Accessors

2004-02-29 Thread Aaron Sherman
On Fri, 2004-02-27 at 21:57, Luke Palmer wrote: > method bar_attr() will get { $.bar_attr } > will set { $.bar_attr = $_ } I'm confused by this in only one way... since method bar_attr and the accessor bar_attr have the same name, how do I write an accessor that recurses

Re: Thinking about Accessors

2004-02-28 Thread Larry Wall
On Fri, Feb 27, 2004 at 09:27:20PM -0700, John Williams wrote: : On Fri, 27 Feb 2004, Luke Palmer wrote: : > John Williams writes: : > > I want to get from here : > > : > > method bar_attr(?$val) is accessor { : > > $.bar_attr = $val if exists $val; : > > return $.bar_attr; : > >

Re: Thinking about Accessors

2004-02-27 Thread John Williams
On Fri, 27 Feb 2004, Luke Palmer wrote: > John Williams writes: > > I want to get from here > > > > method bar_attr(?$val) is accessor { > > $.bar_attr = $val if exists $val; > > return $.bar_attr; > > } > > > I think this is a good idea. Proxies are a little advanced for som

Re: Thinking about Accessors

2004-02-27 Thread Luke Palmer
John Williams writes: > I want to get from here > > method bar_attr(?$val) is accessor { > $.bar_attr = $val if exists $val; > return $.bar_attr; > } > > to here > > method bar_attr() is rw { > return my $x is Proxy ( >for => $.bar_attr, >

Thinking about Accessors

2004-02-27 Thread John Williams
This may all be explained in the upcoming A12, but I'm trying to get Accessors figured out in my head, and I had a few questions and comments. = paraphrased from Damian in http://www.nntp.perl.org/group/perl.perl6.language/9576) it seems very likely that if you write: class Foo { #