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

C# 8 as prior art #30

Open
rbuckton opened this issue Jul 14, 2019 · 0 comments
Open

C# 8 as prior art #30

rbuckton opened this issue Jul 14, 2019 · 0 comments

Comments

@rbuckton
Copy link

rbuckton commented Jul 14, 2019

C# 8 (as of Preview 5) has added a new index and slice notation ([1], [2]):

  • An Index type (System.Index) that specifies an offset and direction.
  • The ^n syntax to specify an offset from the end of a sequence (array, etc.).
    • ^n is shorthand for new Index(n, true)
  • The Range type (System.Range) that specifies a start/end Index in a sequence.
  • The x..y range operator.
    • x..y is shorthand for new Range(new Index(x), new Index(y))
    • ..y is shorthand for new Range(Index.Start, new Index(y))
    • x.. is shorthand for new Range(new Index(x), Index.End)
    • .. is shorthand for new Range(Index.Start, Index.End)

Also, since the ^ operator is currently only an infix operator, perhaps a ^ prefix operator might be worth considering for this proposal as well.

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