-
Notifications
You must be signed in to change notification settings - Fork 800
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
Support using Slice
to enable slicing syntax expr1[expr2..expr3]
#17377
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
* The C# spec defines "countable" types as those having either a `Length` getter, a `Count` getter, or both; if both, `Length` is preferred. See: https://github.com/dotnet/csharplang/blob/d9caa3ce753a6b9583da9bdeba316bcb0fe84d44/proposals/csharp-8.0/ranges.md#implicit-index-support
Hi @brianrourkeboll , I noticed this PR which was put on hold during the release freeze prior to .NET 9 ;; that is not a concern anymore. Is it ready for review, WDYT ? |
@T-Gro no, this is not ready. I'll need to get back to working on the RFC and either flesh out an updated design for from-end slicing — and thus also how we should deal with |
I think a pared-down version would work here. System.Index and System.Range can be enabled independently, assuming there are enough use cases worth supporting. |
Description
Slice
method to enable slicing syntaxexpr1[expr2..expr3]
.Slice
method instead of requiringGetSlice
method fsharp/fslang-suggestions#1317Checklist
Notes
It was rather difficult to follow the existing flow of logic in the indexing/slicing typechecking, and it became even harder as I added the new logic, so I refactored it. I hope it's at least a little bit clearer: the main control flow logic is now centralized in the final pattern match.
fsharp/src/Compiler/Checking/CheckExpressions.fs
Lines 6971 to 7004 in b4d3224