-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent core perl behaviour ? #898
Comments
From rick.delaney@home.comDavid Cassell wrote:
It is no more meaningless than the offset of 4 was after the line @array=();
I agree that the behaviour is not a bug but it seems there is a tiny =item splice ARRAY,OFFSET,LENGTH,LIST =item splice ARRAY,OFFSET,LENGTH =item splice ARRAY,OFFSET Removes the elements designated by OFFSET and LENGTH from an array, and If OFFSET is negative then it start that far from the end of the array. push(@a,$x,$y) splice(@a,@a,0,$x,$y) These are not equivalent if May I suggest changing If OFFSET is negative then it start that far from the end of the array. to If OFFSET is negative then it starts that far from the end of the array. Please note that I've also changed "start" to "starts" so even if you -- |
From [Unknown Contact. See original ticket]This bug is still true. According to the docs the following two should be $a[$x] = $y splice(@a,$x,1,$y) However, they are not. This simple case shows: $x[5]=5; # prints splice(@x,5,1,7); # prints -spp |
From @simoncozensOn Mon, Dec 11, 2000 at 03:31:37PM -0500, Stephen P. Potter wrote:
This is even tested for: print "not " unless j(splice(@a, 20, 0, 12, 13)) eq "" && j(@a) eq j(0..13); So what's right? Is it the documentation or the tests? If it's the Inline Patch--- pp.c~ Sun Dec 24 01:39:33 2000
+++ pp.c Sun Dec 24 01:53:26 2000
@@ -3708,8 +3708,9 @@
length = AvMAX(ary) + 1;
}
if (offset > AvFILLp(ary) + 1)
- offset = AvFILLp(ary) + 1;
- after = AvFILLp(ary) + 1 - (offset + length);
+ av_fill(ary, offset + length);
+
+ after = av_len(ary) + 1 - (offset + length);
if (after < 0) { /* not that much array */
length += after; /* offset+length now in array */
after = 0;
And rewrite your own tests... |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#1832 (status was 'resolved')
Searchable as RT1832$
The text was updated successfully, but these errors were encountered: