dotnet / dotnet/vblang

[Proposal] Add support for ranges

Open
#418 26 comments 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

As C# is going to support [ranges](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-8.0/ranges.md) in 8.0, I think Visual Basic should also support it.
Considering the old grammer to declare array in VB6, we can support ranges like:
``` vbnet
Dim s = "Hello!"
Dim c1 = s(1) ' c1 = "e"c
Dim c2 = s(^2) ' c2 = "o"c, the `^` indicates it counts from the end
Dim s1 = s(2 To 3) ' s1 = "ll"
Dim s2 = s(2 To ^3) ' s2 = "ll"
```
I chose `-` instead of `^` at first, but then I changed my mind because the original indexer accepts `Integer`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.