-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds support for negative indexes in arrays / strings. ``` bash [1,2,3][-1] #3 ``` There is one change that might alter existing ABS scripts, and that's non-existing indexes, for strings, returning an empty string rather than `null`. I believe it's an ok thing to break as both will evaluate to `false` when casted to boolean, and to check whether an index exists one can simply: * check the length of the string (`s.len()`) * check the boolean value of the index (`!!s[idx]`) both these examples do not break with these changes. I instead admit that it would be weird to see code such as: ``` bash if s[idx] == null { ... } ``` rather than ``` if !s[idx] { ... } ``` So I guess this is a change that can go through, as it really shouldn't impact much of the userbase.
- Loading branch information
Showing
4 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters