Tom Christiansen wrote:
>
> Well, I have rather bad news for you. It's not going to be undocumented.
> It's something that's been there for years, and people rely upon it.
And if they rely upon it then it should continue to be reliable. I'm
not suggesting anything that would make your example cease to work.
> You can't define the problem of backwards compatibility out of existence
> just by not documenting it. I repeat: you'd be shot.
>
> But no matter, I'm not going to remove its documentation. That would
> be dishonest and wrong.
Fine, but let's document it properly. Instead of
As a special rule, if a list slice would produce a list
consisting entirely of undefined values, the null list is
produced instead.
keep it simple and say
A slice of a null list will always produce a null list.
which is true. It's also essentially what's going on in (getpwent)[7,0]
since getpwent returns () when it runs out of entries.
But it's just not sensible that
@a = (undef, undef); # @a has two elements
@b = @a[0,1]; # @b has two elements
@c = (undef, undef)[0,1];# @c has *zero* elements
and I think this should be fixed. However, I agree that it would be a
terrible blunder to fix this and break
@a = ()[0,1];
Here, @a should have zero elements, not two. This would be sensible and
leave your (getpwent)[7,0] example intact.
--
Rick Delaney
rick.delaney@home.com