-
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
[Epic] The Great Indexing Compromise #2117
Comments
Submitted by: BrianH Note: The bounds checking changes introduced in Rebol 3 (first "" == none rather than triggering an error) are pointedly not part of this compromise. If we need to tweak those, that's a separate debate that hasn't happened yet (though Ladislav and I discussed some ideas a while ago, to no conclusion yet). This is just about the overall indexing model(s). |
|
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
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
Implemented in Ren-C, without significant concern over compatibility. The body of affected code that is in use which can't be patched is too small to worry over, and the goal of compatibility is generally to match Rebol2 and Red semantics vs. the (non-existent) R3-Alpha codebases that don't already use Ren-C in 2018. |
Submitted by: abolka
Rebol 2, Rebol 3, and Red currently all use slightly differing indexing models -- the stuff that underlies how path-based indexing, pick, poke, index? work.
Under much sweat and tears, this issue was intensely and extensively debated on the REBOL4 AltME world during Nov 2012. Without trying to summarise or even repeat the argument here, none of the two prominent positions could reach convincing consensus. But behold: many participants sensed eventually, that a compromise was reached.
This is a meta-issue to summarise and track the steps toward that compromise.
The corner stones of this compromise:
pick [] 0
would cause an error (and not silently return NONE as in R2).CC - Data [ Version: r3 master Type: Issue Platform: All Category: Unspecified Reproduce: Always Fixed-in:none ]
The text was updated successfully, but these errors were encountered: