Skip to content
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

Function argument commas #20526

Open
2 tasks done
squidink7 opened this issue Jan 14, 2024 · 0 comments
Open
2 tasks done

Function argument commas #20526

squidink7 opened this issue Jan 14, 2024 · 0 comments
Labels
Feature Request This issue is made to request a feature.

Comments

@squidink7
Copy link
Contributor

squidink7 commented Jan 14, 2024

Describe the feature

When calling function in V, each argument requires a comma to separate them. This is traditionally how most programming languages work, however it is inconsistent with struct fields and array elements which don't require comma separators. Commas are also not required when calling functions with optional arguments (parameter structs).
e.g. this works:

set_option(name: 'fullscreen' value: true)

or

set_option('fullscreen', true)

but this doesn't

set_option('fullscreen' true)

Use Case

For consistency in V's syntax

Proposed Solution

This is a matter of personal preference as to whether function arguments should require commas or not, however the current situation is inconsistent, and standardising on one behaviour would be nice.
I would personally vote for commas being optional but inserted with vfmt

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

master

Environment details (OS name and version, etc.)

V full version: V 0.4.4 c5a6aeb.9560d53
OS: linux, "Arch Linux"
Processor: 12 cpus, 64bit, little endian, AMD Ryzen 5 7640U w/ Radeon 760M Graphics

getwd: /home/sirsegv
vexe: /home/sirsegv/.v/v
vexe mtime: 2024-01-14 02:10:25

vroot: OK, value: /home/sirsegv/.v
VMODULES: OK, value: /home/sirsegv/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.0
Git vroot status: weekly.2023.51-191-g9560d535
.git/config present: true

CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

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.

@squidink7 squidink7 added the Feature Request This issue is made to request a feature. label Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

No branches or pull requests

1 participant