Skip to content

String Slices #26

Closed Answered by springcomp
springcomp asked this question in Q&A
Mar 3, 2022 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

There is an important caveat to this JEP !

Currently, slice-expression is a projection, which means that the resulting items being sliced are projected to the downstream expressions.

Consider:

search( [::].length(@), ["one", "two", "three"] ) -> [ 3, 3, 5 ]

This does not seem to be the behaviour we want when applied to strings.
Do we really want to have two different behaviours here 🤔 ?
Which of the following two results should be correct ?

search( [::].length(@), "one" ) -> [ 1, 1, 1 ]
search( [::].length(@), "one" ) -> 3 (expected result ?)

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@innovate-invent
Comment options

@springcomp
Comment options

Comment options

You must be logged in to vote
1 reply
@springcomp
Comment options

springcomp Aug 1, 2022
Maintainer Author

Comment options

You must be logged in to vote
1 reply
@springcomp
Comment options

Answer selected by springcomp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Improvements or additions to documentation, including specifying behaviour jep-candidate JEP (Draft) available - please vote!
2 participants