[Proposal] Align function declarations
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Introduce `Func` for all kinds of function declarations
- Function declaration
- Expression-bodied-function
- Lambda function
## Details
Before:
```VB
Function Add(x As Integer, y as Integer)
Return x+y
End Func
Public ReadOnly Add As Func(Of Integer, Integer, Integer) = Function(x, y) x + y
numbers.Aggregate(0, Function(acc, x) acc + x)
Public Function Where(Of T)(source as IEnumerable(Of T), predicate as Func(Of T, Boolean)) As IEnumerable(Of T)
...
End Function
```
After:
```VB
Func Add(x As Integer, y as Integer)
Return x+y
End Func
Func Add(x As Integer, y as Integer) x + y
numbers.Aggregate(0, Func(acc, x) acc + x)
Public Func Where(Of T)(source as IEnumerable(Of T), predicate as Func(Of T, Boolean)) As IEnumerable(Of T)
...
End Func
```
## Why should we do this?
VB.NET is all about writing code that is intuitive, easy to read and understand. A mixture between `Function` and `Func(Of ...)` is not intuitive and the `Function` keyword is not concise to read for lambdas, see #371.
## Why shouldn't we do this?
- Ambiguous way to define a function (either `Function` or `Func` keyword)
- Deviate from VB6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.