When calling a method that takes no arguments is it possible, to exclude the open and close parenthesis. eg (). Would the grammar also allow, for use to make the () optional when defining a method that has empty parameters?
eg.
Sub Foo()
End Sub
Function Foo() As Bar
End Function
can be written just as.
Sub Foo
End Sub
Function Foo As Bar
End Function
The ability to call a subroutine without parenthesis is a relic of legacy. It has nothing to do with whether the subroutine has arguments; that's just the amount of that legacy that survived to VB.NET from VB6 and prior dialects. In VB6 you were not supposed to call a subroutine with parenthesis, unless you used the CALL keyword. Accidentally including the parenthesis in single-argument calls would change the semantics of that call, forcing the parameters to effectively be by-value due to the arguments being the result of an expression rather than a variable.
However, no dialect of BASIC or VB has permitted omitting the parenthesis in the declaration of a subroutine, arguments or not. It makes no sense to introduce said syntax now.
We are now taking language feature discussion on https://github.com/dotnet/csharplang for C# specific issues, https://github.com/dotnet/vblang for VB-specific features, and https://github.com/dotnet/csharplang for features that affect both languages.
Most helpful comment
The ability to call a subroutine without parenthesis is a relic of legacy. It has nothing to do with whether the subroutine has arguments; that's just the amount of that legacy that survived to VB.NET from VB6 and prior dialects. In VB6 you were not supposed to call a subroutine with parenthesis, unless you used the
CALLkeyword. Accidentally including the parenthesis in single-argument calls would change the semantics of that call, forcing the parameters to effectively be by-value due to the arguments being the result of an expression rather than a variable.However, no dialect of BASIC or VB has permitted omitting the parenthesis in the declaration of a subroutine, arguments or not. It makes no sense to introduce said syntax now.