What don't you like about V / what would you like to be changed? #7610
Replies: 220 comments 867 replies
-
What i like:
What should be changed imho:
i hope i covered everything. otherwise i will extend this list. |
Beta Was this translation helpful? Give feedback.
-
@danieldaeschle's list is quite well, however I still have a few things to ask for For V itself:
For vlibThis portion could be done after 0.3 as no syntax changes are needed. Just wanted to see your opinion.
|
Beta Was this translation helpful? Give feedback.
-
I would request you to reconsider default function arguments. It has a lot of utility while avoiding code duplication. This will specially help as there is no function overloading. This will also make the standard library less bloated. |
Beta Was this translation helpful? Give feedback.
-
My very subjective ideas are: //A constants declaration
to be
//B << operator // C logical operators
to be
|
Beta Was this translation helpful? Give feedback.
-
Something like pythons |
Beta Was this translation helpful? Give feedback.
-
What are you thinking about chained comparison? |
Beta Was this translation helpful? Give feedback.
-
Why not initialize with simple = automatically at first appearance, instead of requiring := ? A thing that I find somewhat contradictory is to need types "after varname", except when using mut, which has to be "before varname". Why not let the types come before or after the var name, as a user choice rather than a required order? |
Beta Was this translation helpful? Give feedback.
-
hello all, really thanks for the excellent language! I am working on Linux kernel (with real-time extension: Preempt-RT or Xenomai )and driver development for hard real-time control system, so I hope V to be a "modern C", can 100% replace C in low level , the first layer over hardware. the missing part:*) Data structure alignment: support enforce data structure padding&packing&align manually. This feature is need due to hardware's register are fixed already, software need follow the hardware spec when define a struct/array for register set. Also need by cache line fits. https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Common-Type-Attributes.html#Common-Type-Attributes *) sperate API for creation of real threads and co-routine: real threads are needed by time critical code (e.g. hard realtime OS); co-routines are for non-realtime code. nice to have if possiable:*) stack size estimation at compile time: maybe with certain limits (e.g. don't allow variable logic arrays, disable recursion...), stack size can be estimation at compile time, avoiding stack overflow and gain good performance by avoiding dynamic stack size allocation (as Go's design); performance is important for hard real-time system (Preempt-RT Linux, Xenomai, Vxworks and other RTOS), latency/jitter is < 10us on a fine tuned x86_64 CPU, so they need avoid dynamic memory allocation in the realtime loop. various embedded system with small memory may also benefits. Thanks & best regards, fino/ |
Beta Was this translation helpful? Give feedback.
-
My personal list from what I've found playing around, beyond what I've seen above:
A bit more iffy:
|
Beta Was this translation helpful? Give feedback.
-
'Gated' arrays a:='0123456789'
assert a#[..20]=='0123456789' // true
assert a#[-20..]=='0123456789' // true
assert a#[-4..20]=='6789' // true
assert a#[20..]=='' // true, it never return an error, it return an empty array.
a[-4..20] ==> ERROR
a[20..] ==> ERROR // without gate symbol the behaviour will be the usually where the |
Beta Was this translation helpful? Give feedback.
-
Struct Memory Layout Struct A{
a int
b int
}
Struct B{
a f32
b int
}
v1 := A{b:1} // A b's displacement in memory is 4
v2 := B{b:1} // B b's displacement in memory is 4 This feature is needed to use V for low level in OS and system programming |
Beta Was this translation helpful? Give feedback.
-
It would be nice if you could do something like |
Beta Was this translation helpful? Give feedback.
-
[fixed]
mut arr := []int{ 2, 0 }
arr[0] = 4 // valid
arr << 4 // compile error |
Beta Was this translation helpful? Give feedback.
-
I know this might create a heated discussion, but I'd love to be allowed to use
. I know this is against the "one way to do things" philosophy and I completely understand that point of view and the reasons for not allowing this, but I think most people are used to doing it this way and probably all or most new V developers will run into this 'feature' of V. We're a team and just checking if V is for us, and all of us are annoyed by this behaviour. In our opinion it also makes sense to wrap a condition in brackets. By the way, why is this possible:
? The brackets aren't necessary - but they do improve readability. And I know cases where there will be an improvement to readability when you wrap one single condition in brackets as well. So I propose: Please allow brackets around conditions, even if they are not necessary. Thank you a lot for that nice language nevertheless! |
Beta Was this translation helpful? Give feedback.
-
Feature request: Overloadable array indexing numpy's If a struct could overload indexing, that would make great syntax for a version of Example syntax: voxels := ndarray([1,2,3,4,5,6,7,8,9], [3,3,3])
assert voxels[0,0,0] == 1
assert voxels[0,0,1] == 2
assert voxels[0,0,2] == 3
assert voxels[0,0,0..2] == [1,2,3] For serialization, you often need to support runtime editable strides/offsets, which limits the amount of compiler magic one can do. |
Beta Was this translation helpful? Give feedback.
-
idk but I'm always getting more and more interested in V... I always thought it a toy language for everyone's fun, but now at least it seems that it's a promising tool for me to do toy things. |
Beta Was this translation helpful? Give feedback.
-
Please add ROR/ROL circular shift (rotate) operators alongside left and right shift operators. As a bare-metal programmer, I find this very useful and the lack of these operators in C is a pain. In C you have to use different hacks, such as Inline asm or compilers intrinsics like __builtin_rotateleft8 for Clang or __rolb for GCC. These methods do not help to write portable code. Of course, you can write a function for this and pray that the compiler is smart enough to optimize rotate_left_8 in one instruction. Alternatively, you can always check the compiled code. However, it's not a solution. Therefore, the rotr and rotl were added to C++20. I think that in any reasonably low-level language like C, circular shift operators should be part of the language. Also, efficient implementation of bitwise operations is a necessary condition for writing performance code. |
Beta Was this translation helpful? Give feedback.
-
I have two suggestions.
I really don’t like If unwrapping 2: |
Beta Was this translation helpful? Give feedback.
-
Something that trips me up is not being able to construct primitive types in the same way as structs, e.g:
Is this inconsitency really neccessary? |
Beta Was this translation helpful? Give feedback.
-
Its all about abstraction - as such I do not know that object2 is a type alias and do not need to know, all I need to know is that some fucntion I call wants an object2 |
Beta Was this translation helpful? Give feedback.
-
All access and transformations on object2 are via function calls into a module and only that module knows how its implemented, I as a mere user of the object, do not care how it is implemented. |
Beta Was this translation helpful? Give feedback.
-
I want to organize the syntactic sugar of other languages (such as JavaScript, Python, Go, Rust, etc.) and propose adding the useful parts to the V language. |
Beta Was this translation helpful? Give feedback.
-
Here are all the features I came up with that I consider useful.
|
Beta Was this translation helpful? Give feedback.
-
I think the compiler should enforce initialization of "sum types", since it is very easy to inadvertently change the order of addition, resulting in an unpredictable behavior. type MyType = string | int
x := MyType{}
println(x) // MyType('')
type MyType = int | string
x := MyType{}
println(x) // MyType(0) |
Beta Was this translation helpful? Give feedback.
-
I would like to request that the json encoder recognize I would like this code to run: @[json: 'mything']
struct Structure {
name string
}
k := Structure{'foo'}
str := json.encode(k)
assert str == `{"mything": {"name": "foo"}}'
l := json.decode(Structure, test_]str) or { Structure{"FAILURE"} }
assert l.name == "foo" A more complex example, this would en/decode:
|
Beta Was this translation helpful? Give feedback.
-
Comptime match:
|
Beta Was this translation helpful? Give feedback.
-
We need a internal primary type |
Beta Was this translation helpful? Give feedback.
-
Vscode extension for syntax highlighting to work better |
Beta Was this translation helpful? Give feedback.
-
I like v have more functions to gg module, add high level api such as: is_screen_touch(touch_id), is_screen_draging, ... to gg module , have music module like sonic pi (https://sonic-pi.net/), and module to create some beautiful vfx for game like explosion, fire, smoke, spark, magic, ... |
Beta Was this translation helpful? Give feedback.
-
VUI needs more attention, particularly as a featured module on the front page and as something new users would obviously look at. Even just updating the roadmap, would be a good gesture. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After
0.40.6, we'll be going for 1.0 right away, freezing the syntax, similar to what Go did.So if something has to be changed, now is the time to do it.
Please post your criticisms of V, there's a good chance that things you don't like will be fixed/improved.
Beta Was this translation helpful? Give feedback.
All reactions