-
Notifications
You must be signed in to change notification settings - Fork 1
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
PICK and POKE of strings have off-by-one error with indexes < 1. #608
Labels
Comments
Submitted by: BrianH Note that this bug exists in R2, for blocks as well. This needs to be fixed – it’s like picking and poking in Roman numerals. |
Submitted by: Carl See also #857 |
Submitted by: BrianH See also #609 - the same bug for AT. |
This was referenced Jan 12, 2016
Oldes
added a commit
to Oldes/Rebol3
that referenced
this issue
Jun 13, 2018
In Rebol2, picking value with index 0 was always returning null. In R3-alpha it was changed that zero index was working like index -1... more at this blog http://www.rebol.net/cgi-bin/r3blog.r?view=0173 I decided to revert this change and let it working as before (and so be compatible with Red too) So now it works for example like: >> pick tail "123" -1 == #"3" >> pick tail "123" 0 == none and it is also consistent with AT positioning: >> at tail "123" -1 == "3" Related issues: metaeducation/rebol-issues#608 metaeducation/rebol-issues#609 metaeducation/rebol-issues#748 metaeducation/rebol-issues#857 metaeducation/rebol-issues#2117 and also: metaeducation/rebol-issues#613
hostilefork
added a commit
to metaeducation/ren-c
that referenced
this issue
Jun 14, 2018
Consensus in general was that the negative indexing behavior of R3-Alpha was not pleasing. This restores the historical behavior. Also makes it so that picking with DECIMAL! will round the decimal down and use the INTEGER! value, vs. SELECT-ing the DECIMAL. Commit initiated by Oldes in: Oldes#5 His comments there: "In Rebol2, picking value with index 0 was always returning null. In R3-Alpha it was changed that zero index was working like index -1... more at this blog http://www.rebol.net/cgi-bin/r3blog.r?view=0173" "I decided to revert this change and let it working as before (and so be compatible with Red too)" "So now it works for example like:" >> pick tail "123" -1 == #"3" >> pick tail "123" 0 == none "and it is also consistent with AT positioning:" >> at tail "123" -1 == "3" "Related issues:" metaeducation/rebol-issues#608 metaeducation/rebol-issues#609 metaeducation/rebol-issues#748 metaeducation/rebol-issues#857 metaeducation/rebol-issues#2117 "and also:" metaeducation/rebol-issues#613
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Submitted by: BrianH
PICK and POKE of string types skip the 0 index, and negative indexes are shifted accordingly. PICK and POKE of block types work correctly.
CC – Data [ Version: alpha 33 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 55 ]
The text was updated successfully, but these errors were encountered: