Perl6 RFC Librarian wrote:
The effects of applying Cprivate to a single hash entry would be to:
=over 4
=item 1.
mark the entire hash as non-autovivifying (except via future calls to
Cprivate -- see below)
This is an interesting proposal, but it seems to be missing something, or maybe I
On Tue, 05 Sep 2000 19:08:18 -0600, Tom Christiansen wrote:
exists (sometimes causes autovivification, which affects Ckeys)
That's not technically accurate--exists never causes autovivification.
print exists $hash{foo}{bar}{baz};
use Data::Dumper;
print Dumper
print keys %hash, "\n";
exists $hash{key}{subkey};
print keys %hash, "\n";
Or did that get fixed when I wasn't looking?
No, the - operator has not been changed to do lazy evaluation.
That's not required. All that is necessary is for Cexists nodes
in the op
Why can't we just apply the same warnings on hashes as we do on
variables in Perl? Maybe a new lexical pragma:
no autoviv; # any autovivification carps (not just
# hashes)
no autoviv 'HASH'; # no new
On Tue, 05 Sep 2000 19:08:18 -0600, Tom Christiansen wrote:
exists (sometimes causes autovivification, which affects Ckeys)
That's not technically accurate--exists never causes autovivification.
print exists $hash{foo}{bar}{baz};
use Data::Dumper;
print Dumper
exists (sometimes causes autovivification, which affects Ckeys)
That's not technically accurate--exists never causes autovivification.
print keys %hash, "\n";
exists $hash{key}{subkey};
print keys %hash, "\n";
Or did that get fixed when I wasn't looking?
"David E. Wheeler" [EMAIL PROTECTED] writes:
On 1 Sep 2000, Perl6 RFC Librarian wrote:
This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Objects : Private keys and methods
Here, here amen, Damian! This one gets my instant vote!
And
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 =
On 1 Sep 2000, Perl6 RFC Librarian wrote:
Private entries of hashes could be Iindirectly accessed in packages
that inherit from the entry's package, by qualifying (i.e. prefixing) the
key with the entry's package name. For example:
package Base;
sub new {
private $self-{data} = $derdata;
should be $derdatum here?
Yes. Thanks.
Damian
Once a hash has been Cprivate-ized, the only way to extend its set of
entries is via another call to Cprivate:
sub new {
my ($class, %self) = @_;
bless private \%self, $class;
private $self{seed} = rand; # okay
11 matches
Mail list logo