> private $hash{key};
> private $hash{$key};
> private $hashref->{key};
>
> or to a hash slice:
>
> private @hash{qw(_name _rank _snum)};
>
> or to a complete hash (either directly, or via a reference):
>
> private %hash;
> private { _name => "demo", _rank => "private", _snum => 123 };
> private bless { @attrs }, $class;
> bless private { @attrs }, $class;
Will "private" be a true scoping keyword? Or under strict would you have
to do this:
private my %hash;
> Note: an alternative would be to make C<private> a subroutine attribute:
>
> sub check : private { ... }
Has any consideration been given to consistently applying "private" as
an attribute throughout?
my %hash : private;
$hash{$key} : private = "5"; # I know, I made this up. :-)
sub dostuff : private { }
my sub dostuff : private { }
Personally, it reads better to me. I know that the "$hash{$key} :
private" syntax doesn't work (yet, AFAIK), but I'd rather keep the
scopes out front:
my %STATE;
our $DEBUG;
And the attributes in back:
my %STATE : private;
our $DEBUG : public; # "public" implied and default
Also, on a related issue, any reason why we shouldn't make this:
my $hash{$key} = $val;
Automatically scope %hash lexically in Perl 6?
-Nate
- Re: RFC 188 (v1) Objects : Private keys and methods Tom Christiansen
- Re: RFC 188 (v1) Objects : Private keys and methods Tom Christiansen
- Re: RFC 188 (v1) Objects : Private keys and methods John Siracusa
- Re: RFC 188 (v1) Objects : Private keys and metho... Piers Cawley
- Re: RFC 188 (v1) Objects : Private keys and methods Kenneth Lee
- Re: RFC 188 (v1) Objects : Private keys and methods Kenneth Lee
- Re: RFC 188 (v1) Objects : Private keys and methods Damian Conway
- Re: RFC 188 (v1) Objects : Private keys and methods David E. Wheeler
- Re: RFC 188 (v1) Objects : Private keys and metho... Piers Cawley
- Re: RFC 188 (v1) Objects : Private keys and methods Nathan Wiger
- Re: RFC 188 (v1) Objects : Private keys and methods Damian Conway
- Re: RFC 188 (v1) Objects : Private keys and methods Dave Rolsky
- Re: RFC 188 (v1) Objects : Private keys and methods Jonathan Scott Duff
- Re: RFC 188 (v1) Objects : Private keys and methods Damian Conway
- Re: RFC 188 (v1) Objects : Private keys and metho... Tom Christiansen
- Re: RFC 188 (v1) Objects : Private keys and m... Bart Lateur
- Re: RFC 188 (v1) Objects : Private keys a... Tom Christiansen
- Re: RFC 188 (v1) Objects : Private keys and metho... Jonathan Scott Duff
- Re: RFC 188 (v1) Objects : Private keys and metho... Damian Conway
- Re: RFC 188 (v1) Objects : Private keys and methods Glenn Linderman
