Re: RFC 188 (v2) Objects : Private keys and methods

[email protected] (Jonathan Scott Duff) Tue, 19 Sep 2000 15:35:10 -0500
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
On Tue, Sep 19, 2000 at 12:35:31PM -0700, Nathan Wiger wrote:
> > This RFC proposes two new keywords -- C<private> and C<public> -- that limit
> > the accessibility of keys in a hash, and of methods.
> 
> I still think these should be attributes across the board:
> 
>    my $hash{$key} : private = $val;
>    my @hash{qw(_name _rank _snum)} : public;
>    sub dostuff : private { }
> 
> I'd be interested what others think.

With the exact same semantics?  I.e.,

	my $hash{$key} : private = $val;

makes %hash non-autovivifying, thus forcing the programmer to
"declare" all of the hash keys he intends to use?  And how would the
programmer do this in your scheme?

	my @hash{$key1,$key2,$key3} : private;

?

-Scott
-- 
Jonathan Scott Duff
[email protected]