-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to omit commas in multiline function signature block #22021
Comments
V seems to allow For example, this works, too, and it looks really odd... fn greet(i1 int, i2 int) {
println('${i1} ${i2}')
}
greet(17 23) |
Oh yes, it does… The parser definitely needs some reinforcement… |
Good find, will fix. I like no comma when there're newlines, that's why I implemented this way back: arr := [
'foo'
'bar'
] Many people are against this, and vfmt was changed to insert a I still think a comma shouldn't be needed here. Just like ; Looks cleaner this way. |
As long as it's documented that either newline or comma works. But then what about OP's comment about function declarations? Shouldn't they work the same way, then? As long as it doesn't work on same line without the comma. |
Just adding an opinion. Agree with the line of thinking that it should be consistent. So in reference to the examples that dadooda gave, if example 2 is allowed, then arguably so should example 4. Otherwise, don't allow both 2 and 4, and force the comma.
Possibly the fear is people doing strange things or mistakes, like multiple blank lines in between. Thus the comma to make sure. |
Describe the feature
It's cool that Vlang lets us omit the comma when using multiline syntax in array enumeration and function calls. Like this:
At the same time, it's not yet possible to omit the comma in
greet()
definition (signature):I'd propose example (4) above to be made possible.
Use Case
Comma omission in multiline enumerations looks good, feels good. And it's partially supported already. Let's make it consistently available in all parts of the language.
Proposed Solution
No response
Other Information
No response
Acknowledgements
Version used
V 0.4.7 7baff15
Environment details (OS name and version, etc.)
Ubuntu 18 under WSL.
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: