-
-
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
:= is allowed in const declaration #22575
Comments
Good find. I will take a look |
Yes, it is allowed, but |
A warning should be there at least |
V should probably warn you about it, but perhaps not... there has been discussion about making |
@medvednikov @spytheman - what do you think? Should V add a warning for this? |
No, it is a deliberate feature, not a bug. There should not be a warning, a notice etc at all.
|
Describe the bug
V compiles the program with the
:=
sign in the constant declaration. This is inconsistent and confusing. The only option described in the documentation is to use the equal sign.Reproduction Steps
cnst.v:
Expected Behavior
Syntax error
Current Behavior
Constants declared with
:=
works finePossible Solution
Disallow using
:=
in constAdditional Information/Context
No response
V version
V 0.4.8 5ec9bb5
Environment details (OS name and version, etc.)
V full version: V 0.4.8 5ec9bb5
OS: linux, Linux version 6.6.8-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Thu, 21 Dec 2023 19:01:01 +0000
Processor: 16 cpus, 64bit, little endian, 12th Gen Intel(R) Core(TM) i5-1240P
getwd: /home/ge
vexe: /home/ge/.vlang/v
vexe mtime: 2024-10-18 16:32:24
vroot: OK, value: /home/ge/.vlang
VMODULES: OK, value: /home/ge/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.46.1
Git vroot status: weekly.2024.42-22-g5ec9bb54
.git/config present: true
CC version: cc (GCC) 14.2.1 20240910
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
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: