dotnet / dotnet/vblang

Concessional Extensions `Let`, `Next`, and `Incr`

Open
#231 16 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

It seems to be a pain point for many not to have these C# (and Java and C++ and Javascript...) operators of `=` (inline assignment), ++i (pre-increment) and i++ (post-increment) operators. Obviously (to those who know modern VB), these can be emulated well enough, especially via extentions. E.g.:


Function [Let](Of T)(ByRef x As T, result As T) As T
' Inline assignment
x = result
Return result
End Function


Function [Next](ByRef x As Integer) As Integer
' i.Next works like i++
Dim x0 As Integer = x : x += 1 : Return x0
End Function


Function Incr(ByRef x As Integer) As Integer
' i.Incr works like ++i
x += 1 : Return x
End Function

I'm proposing coming up with something to standardize the VB equivalents to these, so that translations between C# and VB can go more smoothly. Among the more common complaints against VB is the lack of examples versus what's available in C#, and the use of code translators as a means to cope often get tripped up on `=` and `++`. See for example https://stackoverflow.com/questions/45552216/bitcoin-blockchain-parser-c-sharp-snippet-to-vb.

I'm thinking that if (built-in) standard VB equivalents to `=` and `++` are made, then people who make code translators will make use of them. That in turn will facilitate VB code examples for leading-edge developments.

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.