Proposal: inline variable declaration and assignment within expressions.
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
@AnthonyDGreen this is a follow up to #152 where I asked if we'd get full support for `out` vars and said it would make TryXXX methods easier. What I was getting at is some syntax sugar, so for example this:
```vb
If Integer.TryParse("123", Dim num) Then
Console.WriteLine($"Got number {num}")
End If
```
Would be transformed to this:
```vb
Dim num as Integer
If Integer.TryParse("123", num) Then
Console.WriteLine($"Got number {num}")
End If
```
It was that aspect of `out` vars that jumped out at me when I first heard about them.
Issues like definite assignment and other related complexities never came to mind since VB has never checked those things as an inherent part of the language (in fact I often leverage such quirks for example, to implicitly return `false` in a function where the `true` path may not always execute...the IDE usually says "warning, code may not return a value on all paths" to which I always say, "I know but VB works a little different" 😄).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.