[Proposal] Implicit Default Optional Parameter
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
[(Ported from Roslyn Repo)](https://github.com/dotnet/roslyn/issues/10293)
The grammar definition for an `Optional Parameter` is something similar to this.
```
OptionalParameter ::= "Optional" ParameterName Typing? DefaultToValue?
Typing ::= "As" TypeIdentifier
DefaultToValue ::= "=" ( "Nothing" | ConstantValue )
```
**Examples**
``` vb.net
Foo( Optional arg0 ) ' --> Foo( Optional arg0 As Object = Nothing )
Foo( Optional arg1 As String ) ' --> Foo( Optional arg1 As String = Nothing )
Foo( Optional arg2 As String = Nothing ) ' --> Foo( Optional arg2 As String = Nothing )
Foo( Optional arg3 = "" ) ' --> Foo( Optional arg3 As String = "" )
Foo( Optional arg4 As Integer ) ' --> Foo( Optional arg4 As Integer = Nothing )
Foo( Optional arg5 As Integer = 0 ) ' --> Foo( Optional arg5 As Integer = 0 )
Foo( Optional arg6 As Integer = 1 ) ' --> Foo( Optional arg6 As Integer = 1 )
Foo( Optional arg7 = 7 ) ' --> Foo( Optional arg7 As Integer = 7 )
```
It will simplify the common cases of optional parameter.
Link to Proposal #13
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.