Re: RFC 188 (v1) Objects : Private keys and methods
[email protected] (Piers Cawley) 04 Sep 2000 10:59:09 +0100
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
John Siracusa <[email protected]> writes: > On 9/1/00 4:59 PM, Perl6 RFC Librarian wrote: > > Once a hash has been C<private>-ized, the only way to extend its set of > > entries is via another call to C<private>: > > > > sub new { > > my ($class, %self) = @_; > > bless private \%self, $class; > > private $self{seed} = rand; # okay > > $self{seed} = rand; # dies, can't autovivify > > } > > I'm confused by the last two lines. It seems to me that once the key "seed" > is created via: > > private $self{seed} = rand; > > the following assignment should be okay since it's not trying to make > a new key: > > $self{seed} = rand; > > Or am I misunderstanding the example? I presume it's a typo for $self{secondseed} = rand; # dies -- Piers