HomePhorge

(#22363) Make string and array access operation work as specified.
560411559390Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#22363) Make string and array access operation work as specified.

The implementation relied on Ruby to do the right thing for both
String and Array slice operations. Naturally there were differences
between Ruby 1.8.7 and Ruby 1.9.2. This lead to a revisit of the
specification and a more solid implementation.

For string, a string is always produced (never undef). For array, undef
is produced if a single element is requested (without count) and the
index is outside of range. For a subarray of any length, including 0, an
empty array is always produced if the given range is outside of the
array's range.

For both string and array, a negative start index enumerates from the
end, and a negative count computes the wanted range using first an end
enumeration, and then a computed count (start_index to end_index), if
this is an inverse range (extending to the "left", or if the range is
outside, an empty array / empty string is produced.

In both cases, if there is partial overlap to the left or the right,
the overlapping range is produced.

Details

Event Timeline

Henrik Lindberg <henrik.lindberg@cloudsmith.com> committed rPU560411559390: (#22363) Make string and array access operation work as specified. (authored by Henrik Lindberg <henrik.lindberg@cloudsmith.com>).Dec 5 2013, 1:24 AM