Skip to content
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

Allow expression in index and slice expression #11

Open
innovate-invent opened this issue Mar 5, 2021 · 1 comment
Open

Allow expression in index and slice expression #11

innovate-invent opened this issue Mar 5, 2021 · 1 comment

Comments

@innovate-invent
Copy link

innovate-invent commented Mar 5, 2021

It is very useful to allow data to refer to itself.
I propose bracket-specifier = "[" (number / "*") "]" / "[]" be extended to bracket-specifier = "[" (expression / "*" ) "]" / "[]" for indexes.

slice-expression = [number] ":" [number] [ ":" [number] ] be extended to slice-expression = [expression] ":" [expression] [ ":" [expression] ] for slices

The scope of the expression is the parent of the object being sliced, this can be extended with let()

@innovate-invent innovate-invent changed the title Allow identifier / function-expression in index and slice expression Allow expression in index and slice expression Mar 5, 2021
@innovate-invent
Copy link
Author

innovate-invent commented Mar 6, 2021

It is occurring to me that this would be ambiguous with multiselect list.
for example is [a] equivalent to [@.a] (list) or @[a] (index)
currently it is a multiselect list

I was considering [&a] to disambiguate, but that is already defined as a multiselect list of expressions

perhaps a index(@, i) function? but that would duplicate the index operator

perhaps continue with the way a filter disambiguates? something like [! a] or [* a]

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

No branches or pull requests

1 participant