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

Change slices syntax #54

Open
tmteam opened this issue Jun 15, 2022 · 0 comments
Open

Change slices syntax #54

tmteam opened this issue Jun 15, 2022 · 0 comments
Labels
Syntax Syntactic and semantic improvements and sugars What if? [Candidate]
Milestone

Comments

@tmteam
Copy link
Owner

tmteam commented Jun 15, 2022

Current syntax arr[a:b step c] may conflict with inplace :type notation

It has to be solved before release

Candidates:



# [:: step]

a = [1..4][3 :: 5 step 2]
a = [1..4][3 :: ]
a = [1..4][::5]
a = [1..4][step 2]
a = [1..4][3::5]
a = [1..4][3:: step 5]
a = [1..4][::3 step 5]

# [from to step]

a = [1..4][from 3 to 5 step 2]
a = [1..4][from 3]
a = [1..4][to 5]
a = [1..4][step 2]
a = [1..4][from 3 to 5]
a = [1..4][from 3 step 5]
a = [1..4][to 3 step 5]

# [to step]

a = [1..4][3 to 5 step 2]
a = [1..4][3 to]
a = [1..4][to 5]
a = [1..4][step 2]
a = [1..4][3 to 5]
a = [1..4][3 to step 5]
a = [1..4][to 3 step 5]

# [... step]

a = [1..4][3 ... 5 step 2]
a = [1..4][3...]
a = [1..4][...5]
a = [1..4][step 2]
a = [1..4][3...5]
a = [1..4][3... step 5]
a = [1..4][...3 step 5]

# array as slice (madness!)
(array casts to range)
a = [1..4][2]
a = [1..4][2,3,4]
a = [1..4][3..5 step 2]
a = [1..4][3.. ]
a = [1..4][..5]
a = [1..4][step 2]
a = [1..4][3..5]
a = [1..4][3.. step 5]
a = [1..4][..3 step 5]



----------------------------------------
rejected
# ... step

a = [1..4] 3...
a = [1..4] ...5
a = [1..4] step 2
a = [1..4] 3...5
a = [1..4] 3... step 5
a = [1..4] ...3 step 5
a = [1..4] 3 ... 5 step 2


#  from to step

a = [1..4] from 3 to 5 step 2
a = [1..4] from 3
a = [1..4] to 5
a = [1..4] step 2
a = [1..4] from 3 to 5
a = [1..4] from 3 step 5
a = [1..4] to 3 step 5



@tmteam tmteam added Definitely nice to have Syntax Syntactic and semantic improvements and sugars labels Jun 15, 2022
@tmteam tmteam added this to the First release milestone Jun 15, 2022
@tmteam tmteam added What if? [Candidate] and removed Definitely nice to have labels Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Syntax Syntactic and semantic improvements and sugars What if? [Candidate]
Projects
None yet
Development

No branches or pull requests

1 participant