6 ms·
It's not about the author being a CS major or how the parser is implemented. It's about the author being completely wrong and unwilling to admit it ("parsers ar
by vlang1dot0 6y ago
It's not about the author being a CS major or how the parser is implemented. It's about the author being completely wrong and unwilling to admit it ("parsers are why compilers are slow" -> v 0.2 gets a parser) and being completely ignorant of the basics of writing a compiler.
My generous side says this might just be a language or communication issue but my cynical side says $900 a month on Patreon has a lot to do with it.
However, my pet peeves with the project basically just boil down to the half-truths or outright lies on the home page:
> No null
From their own docs: https://github.com/vlang/v/blob/master/doc/docs.md#calling-c-functions-from-v https://github.com/vlang/v/blob/master/doc/docs.md#calling-c...
we see
error_msg := charptr(0)
and a use 5 lines later with no "unsafe" or other escape hatches in sight. Looks to me like you have null, you just don't have a keyword for it.
> No undefined behavior
What's the behavior of
error_msg := charptr(0)
*error_msg
How are they guaranteeing no UB? The compiler works by generating C via string concatenation. Where does the compiler validate the C generated is free of UB? If it's true via construction, then how do basic issues like [this](https://github.com/vlang/v/issues/6290 https://github.com/vlang/v/issues/6290) [keep](https://github.com/vlang/v/issues/5912 https://github.com/vlang/v/issues/5912) [happening](https://github.com/vlang/v/issues/6206 https://github.com/vlang/v/issues/6206)?
> Pure functions by default
https://github.com/vlang/v/blob/master/doc/docs.md#pure-functions-by-default https://github.com/vlang/v/blob/master/doc/docs.md#pure-func...
https://github.com/vlang/v/blob/master/doc/docs.md#pure-functions-by-default
You're telling me I can read a file off disk in a "pure" function? Wat?
> Generics
Generics only work if there's 0 or 1 type parameters. Support for generics in general is "alpha" quality at best. [Lots of correct code just segfaults the compiler](https://github.com/vlang/v/issues/6263 https://github.com/vlang/v/issues/6263). (If the language has no UB and has bounds checking, why does the compiler seg fault?)
Array.map and Array.filter are not regular library functions with a generic type, they're special cased in the compiler with special syntax.
> V is written in V and compiles itself in under a second.
That's not what fast.vlang.io says: 2080ms.
They could just say that it compiles very fast and link to their benchmark site.
I'm not even going to touch the "no dependencies" claim when you need a C compiler (and often two if you want optimizations).
> C translation (wip)
WIP is overly generous. A very broken version of c2v was released for v0.1 and never updated for v0.2.
> V can emit (human readable) C, so you get the great platform support and optimization of GCC and Clang.
Hopefully you consider C files over 100,000 lines to be readable.
> Powerful built-in web framework
> Built-in ORM
Maybe focus should be spent instead on completing the memory management story which is still a TODO item?
[The author doesn't seem to even understand what he's trying to do.](https://github.com/vlang/v/issues/1247#issuecomment-513467311 https://github.com/vlang/v/issues/1247#issuecomment-51346731...)
When asked what the plan is there, all the community says is that it will be similar to Lobster's (searching "Lobster" on their Discord will show numerous results). However when the reasons why that can't work with V as is currently exists are pointed out, [there is silence](https://github.com/vlang/v/issues/1247#issuecomment-680182564 https://github.com/vlang/v/issues/1247#issuecomment-68018256...). Meanwhile, V has already [promised no breaking changes for at least 5 or 10 years](https://github.com/vlang/v#stability-guarantee-and-future-changes https://github.com/vlang/v#stability-guarantee-and-future-ch...). Perhaps that should have been done after deciding how memory management would work?
You'd think this would be pretty much the top priority at the moment but the handful of buggy commits say otherwise:
- https://github.com/vlang/v/commit/bffa100aa6fbf4842aa6b4f442bd2c273ac35c7f https://github.com/vlang/v/commit/bffa100aa6fbf4842aa6b4f442...
- https://github.com/vlang/v/commit/db51ee08ea269b17bec97fb102f3720914bb2994 https://github.com/vlang/v/commit/db51ee08ea269b17bec97fb102...
- https://github.com/vlang/v/commit/b74c1805d72df8fd6e30cc236a8ada0f7717ab9a https://github.com/vlang/v/commit/b74c1805d72df8fd6e30cc236a...
- https://github.com/vlang/v/commit/e0d20eadff113b3f36fb96226b228793c42febf1 https://github.com/vlang/v/commit/e0d20eadff113b3f36fb96226b...
If look closely, you'll see lots of code under the "autofree" path is commented out. I guess you can't have use after free if you never free?
You'll also notice the author has a consistent pattern of committing commented out code, uncommenting it in a later commit and then recommenting it again because it never worked in the first place. This is probably why the author refuses to go use the PR process for themselves and instead pushes directly to master often breaking CI and the project for everyone else.
The problem with V in my opinion is not that it has high aspirations, it's that doesn't distinguish between aspirations and the mostly unimplemented barely functioning reality of the present. Only the happiest of happy paths currently work which is probably only 10% of the effort required to make a serious programming language. You'd think from their website and their fanatics that they're nearly there when they have yet to even realize how much work hasn't even been started yet.
- delian66 6y agoI am not the language author, just a contributor. There are many contributors like me, that see the potential of V, instead of focusing on petty beefs about how someone had been wrong on the Internet once upon a time. > What's the behavior of error_msg := charptr(0) error_msg 1[23:04:49] /v/nv LINUX $ cat > hate_will_raise_your_cortisol_levels.v error_msg := charptr(0) *error_msg 0[23:05:12] /v/nv LINUX $ ./v run hate_will_raise_your_cortisol_levels.v hate_will_raise_your_cortisol_levels.v:2:2: error: undefined variable: `error_msg` 1 | error_msg := charptr(0) 2 | *error_msg | ~~~~~~~~~ 1[23:05:14] /v/nv LINUX $ cat > hate_will_raise_your_cortisol_levels.v error_msg := charptr(0) *error_msg = 1 0[23:05:32] /v/nv LINUX $ ./v run hate_will_raise_your_cortisol_levels.v hate_will_raise_your_cortisol_levels.v:2:2: error: `error_msg` is immutable, declare it with `mut` to make it mutable 1 | error_msg := charptr(0) 2 | *error_msg = 1 | ~~~~~~~~~ 1[23:05:35] /v/nv LINUX $ 0[23:05:36] /v/nv LINUX $ cat > hate_will_raise_your_cortisol_levels.v mut error_msg := charptr(0) *error_msg = 1 0[23:06:13] /v/nv LINUX $ ./v run hate_will_raise_your_cortisol_levels.v hate_will_raise_your_cortisol_levels.v:2:12: error: modifying variables via dereferencing can only be done in `unsafe` blocks 1 | mut error_msg := charptr(0) 2 | *error_msg = 1 | ^ 1[23:06:13] /v/nv LINUX $ Note that charptr is intended to be used only for easier C interoperability, not in pure V code. Also note, that the V language implementation has not yet reached version 0.2 , and new checks about undefined and dangerous behavior are added on a regular basis. >> V is written in V and compiles itself in under a second. > That's not what fast.vlang.io says: 2080ms. Both are true. What you seem to lack in understanding, is that performance comparisons with absolute time need also another dimension - the hardware on which they are run, and also what backend C compiler is used. On my i3-3225 for example, I can recompile v with tcc in ~0.6s on average (and under 0.5s when v was compiled with clang before that): 0[23:16:04] /v/nv LINUX $ time ./v -cc gcc -show-timings self V self compiling (-cc gcc -show-timings)... PARSE: 175 ms CHECK: 64 ms C GEN: 116 ms C gcc: 4422 ms real 0m4.792s user 0m4.604s sys 0m0.159s 0[23:16:22] /v/nv LINUX $ time ./v -cc clang -show-timings self V self compiling (-cc clang -show-timings)... PARSE: 167 ms CHECK: 62 ms C GEN: 118 ms C clang: 2265 ms real 0m2.629s user 0m2.499s sys 0m0.108s 0[23:16:31] /v/nv LINUX $ time ./v -cc tcc -show-timings self V self compiling (-cc tcc -show-timings)... PARSE: 186 ms CHECK: 66 ms C GEN: 117 ms C tcc: 104 ms real 0m0.489s user 0m0.437s sys 0m0.050s 0[23:16:36] /v/nv LINUX $ > They could just say that it compiles very fast and link to their benchmark site. Yes, but for most people with average hardware produced in the last 10 years, the times will be < 1s much more likely than not, while recompiling from scratch say gcc, or clang, or go for that matter, will definitely not happen for < 1s even with very powerful hardware ... > I'm not even going to touch the "no dependencies" claim when you need a C compiler (and often two if you want optimizations). The V compiler itself do not have dependencies - it is a single C file (see https://github.com/vlang/vc/blob/master/v.c https://github.com/vlang/vc/blob/master/v.c), that can be generated from its V source code (with `./v -o v.c cmd/v`). That v.c file, can then be used to bootstrap v, by needing just a working C99 compiler. In fact that is exactly what the make.bat and Makefile do. You can use just one working C99 compiler, for example gcc to bootstrap v. If you mean that you need 2 compilers, because tcc is so much faster but it does not optimize, well yeah, I do like to use tcc while developing, and then use gcc only when releasing. In my opinion, having the choice to do that is a big feature, not a disadvantage. > Hopefully you consider C files over 100,000 lines to be readable. You can use `-printfn module__func_name` to read single generated C functions that are of interest to you directly in your shell, there is no need to look at the whole generated .c file. Plus even with the full file, most editors have the amazing ability to search for text, so you do not have to read the whole file from start to finish. > Maybe focus should be spent instead on completing the memory management story which is still a TODO item? May be your focus should be on helping the projects that you like, instead of complaining about the ones you do not?