Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

asserts getting removed without -prod flag #23615

Closed
Xyndra opened this issue Jan 30, 2025 · 2 comments
Closed

asserts getting removed without -prod flag #23615

Xyndra opened this issue Jan 30, 2025 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@Xyndra
Copy link

Xyndra commented Jan 30, 2025

Describe the bug

I am running my program with the following flag command D:/software/v/v.exe D:/Code/v/bwinf_25_2a1/src -color -o D:\Code\v\bwinf_25_2a1\bin\main.exe and it removes the asserts.

Additionally, I would like to propose not, under any circumstances, even in production, remove asserts since even in production you would rather crash the program than have everything break. Yes, it slows down the program, but there is something called assert-driven-development where you say you prefer crashes over bugs and therefore instantly crash the program in case of asserts failing. I would be very fond of removing asserts being an opt-in flag, not something forced

Reproduction Steps

fn main() {
	assert false;
        // ...
}

Expected Behavior

it panicking

Current Behavior

my program failing because weird circumstances happened

Possible Solution

fix the bug

Additional Information/Context

When compiling with D:/software/v/v.exe D:/Code/v/bwinf_25_2a1/src -color -g -no-parallel -no-retry-compilation -keepc -cc msvc -o D:\Code\v\bwinf_25_2a1\bin\main.exe it works

V version

V 0.4.9 d0ce8a2

Environment details (OS name and version, etc.)

V full version V 0.4.9 d0ce8a2
OS windows, Microsoft Windows 11 Pro 22635 64-bit
Processor 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Memory 32.89GB/63.67GB
V executable D:\software\v\v.exe
V last modified time 2025-01-29 17:04:02
V home dir OK, value: D:\software\v
VMODULES OK, value: C:\Users\Sammy.vmodules
VTMP OK, value: C:\Users\Sammy\AppData\Local\Temp\v_0
Current working dir OK, value: D:\Code\v\bwinf_25_2a1
Git version git version 2.47.1.windows.1
V git status d0ce8a2 (5 commit(s) behind V master)
.git/config present true
cc version N/A
gcc version gcc (MinGW.org GCC-6.3.0-1) 6.3.0
clang version clang version 19.1.5
msvc version N/A
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version N/A

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.

@Xyndra Xyndra added the Bug This tag is applied to issues which reports bugs. label Jan 30, 2025
Copy link

Connected to Huly®: V_0.6-22040

@JalonSolov
Copy link
Contributor

If it's such a "thing", why does a google search for "assert driven development" only return links for "test driven development"?

The theory behind disabling asserts with -prod is that you will have taken care of any problems in development before releasing such fragile code to others. That you will have added appropriate checks into the code such that the asserts are no longer needed.

It is a much, much better user experience to see a nice error message explaining what happened, than for the program to simply crash & burn.

Personally, if I see a program crash & burn, I just stop using it - I usually don't even bother reporting it, as I feel if they are that careless in their coding, I don't want to run their code.

Of course, this is with the caveat that if I know that I'm using Beta software, I make allowances for that.

@vlang vlang locked and limited conversation to collaborators Jan 30, 2025
@JalonSolov JalonSolov converted this issue into discussion #23617 Jan 30, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants