in reply to Using exists to check element in array
Perl source and tests have had all use of 'exists' on array elements / array refs removed. So running exists on an array element can lead to surprising behavior - because no one is testing what the behavior should be. So essentially the maintainers are reserving the right to modify this behavior by accident.
This situation seems to have come about because originally "exists" on array elements returned true if Perl had allocated a CV pointer for that index, where as now it returns True only if a CV pointer is both allocated and is not set to null. But this change over was not clean and and I think there are situations where it would not always be true. Imagine an array that is extremely large and fragmented in its use of indexes, where memory allocation has trimmed, extended, realloacted various CV linked lists etc. Does perl always only have a CV for each actually 'used' index position? The answer is apparently no.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using exists to check element in array
by LanX (Saint) on Jan 29, 2024 at 03:55 UTC | |
Re^2: Using exists to check element in array
by david (Novice) on Feb 04, 2024 at 03:20 UTC | |
by sectokia (Friar) on Mar 07, 2024 at 00:26 UTC |