>         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

Reply via email to