Skip to content

Slicing out of bound modification#75

Merged
jurgenvinju merged 2 commits intousethesource:website-v2from
jbdoderlein:slicing-out-of-bound-modification
Mar 2, 2026
Merged

Slicing out of bound modification#75
jurgenvinju merged 2 commits intousethesource:website-v2from
jbdoderlein:slicing-out-of-bound-modification

Conversation

@jbdoderlein
Copy link
Contributor

This change is linked to this issue
The implementation is defined in this PR

The goal is to provide clear semantic for "out of bound" as stated at the end of examples :

Slices not do go "out of bounds". Instead they just stop at the end or beginning

The constraint on begin and end were changed to allow all possible slicing.
With L = [0,1,2,3,4,5,6,7,8,9]; :

Documentation Rascal v0.41.3
L[0..0] IndexOutOfBound []
L[..10] IndexOutOfBound [0,1,2,3,4,5,6,7,8,9]
L[10..10] IndexOutOfBound []

This definition is compatible with the use of negative index, and with the min/max, the constraint should hold (which was not the case before).

@jurgenvinju jurgenvinju merged commit 2470a31 into usethesource:website-v2 Mar 2, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants