develooper Front page | perl.perl5.porters | Postings from August 2014

Concerning the branch smoke-me/arc/deprecate-delete-array

Thread Next
From:
Father Chrysostomos
Date:
August 19, 2014 17:01
Subject:
Concerning the branch smoke-me/arc/deprecate-delete-array
Message ID:
20140819170104.18549.qmail@lists-nntp.develooper.com
That branch officially deprecates the use of delete and exists on
arrays, emitting a warning.

I truly hope we don't go in that direction.  I have code that will
produce thousands of warnings.

The added perldiag entry states:

> The semantics of C<delete>
> on array elements is confusing and poorly defined: a deleted array
> element is not considered to exist, but the array's length continues to
> reflect the nonexistent element -- unless there are no non-deleted elements
> at higher indexes in the array, in which case the array's length does I<not>
> reflect the nonexistent elements. If you find this bizarre and
> counter-intuitive, you're not alone, which is why these constructs are now
> deprecated.

If the adjustment of $#foo by delete $foo[...] is the main reason
for deprecating it, then why not just stop delete from changing
the length?

As a regular user of this feature, I can assure you that when I use
delete and exists on arrays the length is irrelevant.  I cannot think
of a use for delete/exists for which the length would matter.

So how about we stop delete from changing the length and do a
CPAN smoke?


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About