You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hate For Unnecessary Curly Brace Enforcement In V
#30642
V had managed to avoid going curly brace nazis, which allowed to optionally and privately use the Allman style if preferred (used often by many C programmers too). It appears in mid version, one of V's latest updates (V 0.5.2 4fce80a) is trying to go full Go. By the way, absolutely hate Go's forced K&R.
So now, all kinds of weird and funky errors will show up (like Go), that can be based on curly brace placement. The below code, if written in Allman style will cause error: break statement not within a loop. If written as K&R, then works as expected.
Allowing private facing Allman or curly brace freedom, is one of the things that makes V superior (or at least more pleasant) than Go. No need for unwanted code nazis enforcement, unless the code is to be displayed publicly or is an office requirement.
fn main()
{
nums := [3,6,7]
m := 5
mut g := 10
for g > m
{
g--
if g in nums { break }
}
println(g)
}
Magically works, if the dreaded K&R
fn main() {
nums := [3,6,7]
m := 5
mut g := 10
for g > m {
g--
if g in nums { break }
}
println(g)
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
V had managed to avoid going curly brace nazis, which allowed to optionally and privately use the Allman style if preferred (used often by many C programmers too). It appears in mid version, one of V's latest updates (V 0.5.2 4fce80a) is trying to go full Go. By the way, absolutely hate Go's forced K&R.
So now, all kinds of weird and funky errors will show up (like Go), that can be based on curly brace placement. The below code, if written in Allman style will cause
error: break statement not within a loop. If written as K&R, then works as expected.Allowing private facing Allman or curly brace freedom, is one of the things that makes V superior (or at least more pleasant) than Go. No need for unwanted code nazis enforcement, unless the code is to be displayed publicly or is an office requirement.
Magically works, if the dreaded K&R
All reactions