dotnet / dotnet/vblang

[Proposal] initialize tuple items in place

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

Description

Suppose I declared this Tuple at class level:
```VB.NET
ReadOnly StringConstants As (First As String, Second As String, Third As String) = ("One", "Two", "Three")
```

I think it is more readable to initialize each item in place like this:
```VB.NET
ReadOnly StringConstants As (
First As String = "One",
Second As String = "Two",
Third As String = "Three"
)
```

And it will be better if we use type inference. I know it is not allowed at class level, but I think tuple elements are local to the tuple, and don't belong to the class. I suggest to treat them as anonymous type elements are treated:

```VB.NET
ReadOnly StringConstants As (First = "One", Second = "Two", Third = "Three")
```

Note:
This syntax at class level will define StringConstants of type object
```VB.NET
ReadOnly StringConstants = (First := "One", Second := "Two", Third := "Three")
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the proposed tuple-initializer forms and the stated class-level type-inference behavior. No files, tests, or entry points are named; done would require settling the syntax and semantics as a Visual Basic language-design change.

Written by the indexing model from the issue text.

Assessment

Tech stack
visualbasic
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.