google / google/jsonnet

Revisit negative array indexing

Open
#1,222 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

So while this was discussed in #113 back in 2016, I wonder if we should revisit this discussion given the recent changes to array slices in #1093.

With array slicing supporting negative indexes, I find it counterintuitive not to have negative indexing in regular array lookups. Especially as we seem to approximate Python's slicing, and Python does have negative indexing.

@sparkprime you made a good argument against it [here](https://github.com/google/jsonnet/issues/113#issuecomment-195693902), I'm curious if you've changed your mind as hinted [here](https://github.com/google/jsonnet/pull/1093#issuecomment-1589976513).

Note: I've had [this related PR in go-jsonnet](https://github.com/google/go-jsonnet/pull/777) open for a while.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.