[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: exists $foo[7] and delete $foo[7]



Gurusamy Sarathy wrote:

> scalar(@array) and $#array are still related in the same way as before,
> but it _would_ be semantically cleaner for the former returning just the
> number of initialized values.  But we really can't do that without
> breaking compatibility.

How so? There's nothing to break compatibility with: The old (current)
definition of C<scalar @foo> would be "the number of elements that exist
in the array (excluding putative non-existent elements that can't yet,
errm, exist)"...

As long as you carry on counting /undefined/ values, nothing can break.
Anyone who did C<@foo=(1, 2, 3); delete $foo[1]; $foo[scalar @foo]=4;>
would get what they deserved ;)

Pete
-- 
use Disclaimer::Standard;	# Motorola GSM Software Factory
my $phone='+44 1793 564450';	# "'Not twisted,' Salzy once said of
my $fax='+44 1793 566918';	#  her own passion, 'it is helical.
my $mobile='+44 7973 725120';	#  That sounds better.'"


Follow-Ups from:
Gurusamy Sarathy <gsar@ActiveState.com>
References to:
Gurusamy Sarathy <gsar@ActiveState.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]