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

2000-09-01 Thread Kenneth Lee
Kenneth Lee wrote: > > > Once a hash has been C-ized, the only way to extend its set of > > entries is via another call to C: > > > > sub new { > > my ($class, %self) = @_; > > bless private \%self, $class; > &g

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

2000-09-01 Thread Kenneth Lee
> Once a hash has been C-ized, the only way to extend its set of > entries is via another call to C: > > sub new { > my ($class, %self) = @_; > bless private \%self, $class; > private $self{seed} = rand; # okay > $self{se

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

2000-09-01 Thread Kenneth Lee
> package Derived; > use base 'Base'; > > sub new { > my ($class, $derdatum, @basedata) = @_; > my $self = $class->SUPER::new(@basedata); > private $self->{data} = $derdata;

partial assignment using lvalue?

2000-08-29 Thread Kenneth Lee
dear all, it seems all the "lvalue sub" RFCs haven't mentioned this. currently we can do $str = "foo bar"; substr($str, 4, 0) = "baz "; and $str will become "foo baz bar". should we be able to do this with lvalue-subs? how can one returns "pointer" to a portion of a scalar? kenneth

no autovivify?

2000-08-29 Thread Kenneth Lee
dear all, today this just came up to my mind, we could have a pragma that disable `autovivification' of hash and array keys. Consider the follow code snippet: @arr = ( 0..9 ); %hash = ( a=>1, b=>2 ); { no autovivify; $arr{10}++; # both are $hash{c}--; # fatal } this way