On 10/30/01 5:12 PM, Damian Conway wrote:
>> # Change apple color, but leave the blue berry
>> $obj.fruit(apple => 'green');
>
> No. You want:
>
> $obj.fruit{apple} = 'green';
Hm, I think I'll be writing arg-type versions of that one because I'm not
too comfortable with exposing the fac
John icked:
> > # # Change apple color, but leave the blue berry
> > # $obj.fruit(apple => 'green');
> > #
> > # print $obj.fruit('apple'); # green
> >
> > $obj.fruit{apple}
>
> Icky, looks "unencapsulated" to me :)
[For the benefit of those playing alon
John asked:
> So, what about simple array accessors?
Writing:
class Demo;
my @.colors is public;
gives you:
> $obj.colors('red', 'green', 'blue');
No. $obj.colors() takes no arguments.
> $obj.colors = ('red', 'green', 'blue');
Yes.
> $obj.color
On 10/30/01 12:13 PM, Brent Dax wrote:
> John Siracusa:
> Please note that these are my best guesses; I'm not a Damian ;^).
>
> # $obj.colors('red', 'green', 'blue');
> #
> # $obj.colors = ('red', 'green', 'blue');
> #
> # $obj.colors = ['red', 'green', 'blue' ];
>
> $obj.colors=('r
John Siracusa:
# Okay, so we've got these guys auto-created if we want:
#
# method foo is lvalue { return $.foo }
#
# (plus or minus the syntax) which lets us do:
#
# $obj.foo = 5;
# print $obj.foo;
#
# So, what about simple array accessors?
Please note that these are my best guesses;
Okay, so we've got these guys auto-created if we want:
method foo is lvalue { return $.foo }
(plus or minus the syntax) which lets us do:
$obj.foo = 5;
print $obj.foo;
So, what about simple array accessors?
$obj.colors('red', 'green', 'blue');
$obj.colors = ('red', 'green