News for hackers. Stuff that matters.
Re:The V Programming Language by non-entity on Tuesday September 15, 2020 @11:36AM (#24482452)
So if I recall correctly? when this language was first announced there was some strange controversy about it mostly being vaporware and serious claims being made about the language and its performance before they were implemented.

I assume this has mostly changed now? Has anyone tried using it recently?

Re:The V Programming Language by burlesona on Tuesday September 15, 2020 @11:52AM (#24482677)
I think when V was first announced (and to a lesser degree still today) it was really hard to tell the difference between the things the author had actually running and what was only “the vision.”

For example, V compiles to C super fast. Then you compile the C code at normal C compilation speed. Very logical design so no complaints there, but the original claims made it sound like it went straight from V to machine code in a blink, which isn’t exactly true.

However I will say that the project has been very active, the author has made his claims a lot more clear, and so far he’s delivering on his promises little by little.

If I were to summarize my experience testing out V, I would say the author looked around at the world of software engineering and said, “there are lots of good pieces out there, but what I want is one language + Stdlib that does absolutely everything, and what the hell, I’m just going to make it myself.”

It’s super ambitious, but it’s also pretty neat.

Re:The V Programming Language by throwaway894345 on Tuesday September 15, 2020 @12:04PM (#24482839)
I wonder what are the tradeoffs between targeting C and targeting LLVM/LLIR? Is it mostly "I know C"? Given that LLVM is purpose-built for this kind of use case, I would expect that it would be the better target, but I'm not very knowledgeable on the subject.
Re:The V Programming Language by eslaught on Tuesday September 15, 2020 @12:39PM (#24483279)
I'm one of the maintainers of the Terra language, so I can shed some light here.

In addition to what the sibling comment said, LLVM is a moving target. The project moves slower now than it used to, but as a general principle, the project does not provide backwards compatibility. That means there is a certain amount of constant effort required just to keep up. Even projects featured on the LLVM homepage get behind, sometimes by a large number of releases.

You're right that LLVM is better for some things. E.g. if you want to generate "real" debug info. Or if you want to generate code for GPUs, without having to teach your compiler to generate what is essentially a different language. But if you're talking about the fastest (and in many ways most stable) path to generating code, you can't really beat source-to-source with C as output.

Re:The V Programming Language by higerordermap on Tuesday September 15, 2020 @12:40PM (#24483289)
Can use any compiler. (GCC sometimes optimizes better than LLVM, GCC has more platform support, TCC can be used for faster compilation).

LLVM interface is unstable.

That said there are things you can't properly implement by compiling to C.

Re:The V Programming Language by posix_me_less on Tuesday September 15, 2020 @01:16PM (#24483809)
> there are things you can't properly implement by compiling to C

Very interesting claim, any examples?

Re:The V Programming Language by pornel on Tuesday September 15, 2020 @07:47PM (#24488011)
• You don't control your ABI. For example, you can't reserve a register for error object return like Swift does.

• You don't control your stack and stack frames. You can't implement a segmented stack, for example.

• You have very limited options for unwinding. setjmp doesn't really cut it. You could leverage C++ exceptions or platform-specific things like SEH, but you can't design anything radically different.

• You can't have debug information fancier than #line and maybe reusing C++ name mangling. You can't make debuggers see your higher-level constructs and data as anything other than their lowering.

• You have very limited options for specifying pointer aliasing.

• If you don't want to inherit UB from C, you'll have to be very clever about using alternative constructs that don't cause UB while still compile to efficient code you wanted.

• If you mean standard C, not C with compiler extensions, then look at the whole list of non-standard intrinsics and built-ins for things C can't do.

Re:The V Programming Language by aweinstock on Tuesday September 15, 2020 @03:26PM (#24485651)
If your source language has some construct that you want to express as state machines (e.g. async, CPS, pattern match compilation), and you want to compile the state machine as direct threaded code[0] (which involves fewer branches than a while-switch), then if you're compiling to C, you need computed gotos[1], which are non-standard.

[0]: https://en.wikipedia.org/wiki/Threaded_code#Direct_threading [1]: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

Re:The V Programming Language by mratsim on Tuesday September 15, 2020 @05:32PM (#24486954)
GCC, Clang, ICC do support computed gotos and you can fallback to ``while true`` loop + switch dispatch for others.

This is what Nim does: https://nim-lang.org/docs/manual.html#pragmas-computedgoto-p...

Re:The V Programming Language by thysultan on Tuesday September 15, 2020 @02:54PM (#24485250)
It's not only interesting, it's blatantly false.
Re:The V Programming Language by Joker_vD on Tuesday September 15, 2020 @12:14PM (#24482978)
Well, emitting C is easier than emitting LLIR. Not just in the sense that you know C already and don't know LLIR yet, but if your source language is close enough to C semantics (basically, it's imperative language), you can most of the time generate the code in one straightforward walk over your whole AST. In fact, translating it to some home-made lowered IR and then to C would probably produce less effective binary.
Re:The V Programming Language by delian66 on Tuesday September 15, 2020 @03:11PM (#24485463)
Re:The V Programming Language by vlang1dot0 on Tuesday September 15, 2020 @03:40PM (#24485810)
There are certainly some good reasons to use C as your backend, but there are some huge downsides as well. The main one in my mind is that you're limited by restrictions placed on you by the target language. V claims no UB but C has lots of UB so extreme care must be taken while doing code generation not to run afoul of C's rules. A quick glance at V's issue tracker shows that is not the case. Nor does there seem to be any plan for solving this.

Other points in that document are frankly baloney:

- Writing programs that pass -Wall -pedantic, Clang analyzer, PVS, and result in zero Valgrind warnings/errors is a dream of any C/C++ developer. With V it's going to be guaranteed for every V program. (We are not there yet, but very close.)

Clang analyzer is not integrated at all so this is not "very close".

Valgrind tests are mostly disabled (especially with -autofree), this is baloney.

Author has yet to set up PVS or Coverity although it was suggested a few days ago on Discord. Again, baloney.

`-Wall -pedantic` Given V can't even compile valid V programs consistently without generating C _errors_ I find this extremely difficult to believe.

> Stability. New languages using LLVM directly are going to crash often. That's inevitable, and can be seen across all new languages using LLVM. The V compiler hasn't crashed once for me, and I haven't received any crash reports from other users.

V issue tracker has lots of instances of the V compiler crashing. "I haven't received any crash reports from other users" is a verifiable fabrication. ([1](https://github.com/vlang/v/issues/6310), [2](https://github.com/vlang/v/issues/6263), [3](https://github.com/vlang/v/issues/4730))

> Simplicity. LLVM is a huge C++ dependency, meaning that both developers of the language and the users are forced to install it. Calling C++ is not easy from V/C, so C wrappers have to be used, increasing the number of dependencies and complexities.

But you need a C compiler. `v -o` requires either clang (and thus LLVM) or GCC both of which are massive dependencies. This logic rings hollow.

Re:The V Programming Language by delian66 on Wednesday September 16, 2020 @01:59AM (#24489967)
> But you need a C compiler. `v -o` requires either clang (and thus LLVM) or GCC both of which are massive dependencies. This logic rings hollow.

It requires a C compiler. You said it yourself. Clang and GCC are not the only existing C compilers. tcc for example is tiny compared to them - on linux, `thirdparty/tcc/` is ~4.1MB, excluding the `thirdparty/tcc/.git` folder, and ~5.8MB including it.

Re:The V Programming Language by delian66 on Tuesday September 15, 2020 @05:27PM (#24486893)
> Author has yet to set up PVS or Coverity although it was suggested a few days ago on Discord. Again, baloney.

I personally, find the following course of events very interesting:

On 2020/09/14, a Discord user named `Engineer` writes the following:

> We should consider using Coverity as this is an opensource github project - we can test the output v filename.v -o filename.c as input for Coverity - to help us understand issues with the generated C code.

Mind you, that is not a code contributor, and his earlier questions, are about a mysterious undisclosed C compiler, that produces much more stricter error messages than gcc's ones.

Then he makes a short lecture on the topic of `What is static analysis?` again on Discord...

It is a Scooby Doo mystery indeed.

I have nothing against Coverity personally - it may very well help the V code generator, but I hate being forced to use a product in such a way.

Re:The V Programming Language by vlang1dot0 on Wednesday September 16, 2020 @09:48AM (#24492674)
Yes, please continue unraveling this "Scooby Doo mystery", I'm sure it will be entertaining for everyone!

Do you think there's a coordinated campaign by(?) Coverity to get your open source project to use it? For what reason? It's surely not to make money considering Coverity gives open source projects a free license.

> I have nothing against Coverity personally - it may very well help the V code generator, but I hate being forced to use a product in such a way.

Yes, two random people telling you to consider using a static analysis tool is "forcing" you to use a product.

----

This is a great example why everyone should stay away from V. Industry standard best practices are treated as conspiracy theories by the developers.

It's fine for people to decide they want to make a new language; that's great! It's also totally fine for all of those people to have no idea what they're doing; that's how you learn. But at some point, you need to recognize that you don't know what you don't know. V is not anywhere close to the level of production ready-ness you yourself have repeatedly claimed.

Re:The V Programming Language by delian66 on Friday September 18, 2020 @04:07AM (#24514179)
I myself do not claim that V is production ready. It is not even 0.2 ... I think it is very disingenuous of you, to put words in my mouth in such a way. I would appreciate, if you stop doing that to me, or others in the future.
Re:The V Programming Language by delian66 on Friday September 18, 2020 @04:09AM (#24514188)
As for Coverity, we are considering it, and afaik Alex has a license for PVS-Studio.
Re:The V Programming Language by pityJuke on Tuesday September 15, 2020 @12:25PM (#24483124)
Part of this authors' "vaporware" criticism aims squarely at his "Volt" app [2] (the reason for this language), which was supposed to be released sometime last year, but as far as I can see, after some buggy beta releases [1], has disappeared again. It may be coming back [3], but a lot of confusion here. [4]

[1]: https://twitter.com/volt_app

[2]: https://volt-app.com/

[3]: https://github.com/voltapp/volt/issues/164

[4]: https://github.com/voltapp/volt/issues/149

Re:The V Programming Language by qppo on Tuesday September 15, 2020 @11:57AM (#24482757)
It got flamed hard on /r/programming several times.

My personal impression was that V was an extremely ambitious project by a single developer without much experience taking on such a project, and the feature list was more of a roadmap last I looked.

There were also some head scratchers in the implementation/libraries and I recall that the playground got pwned and there was a great blog post flaming it but I can't find it at the moment.

Re:The V Programming Language by higerordermap on Tuesday September 15, 2020 @11:48AM (#24482618)
A serious number of CS-defying claims, most of the rest being intellectually dishonest.
Re:The V Programming Language by penagwin on Tuesday September 15, 2020 @12:05PM (#24482867)
To be fair I didn't see a ton of "CS-defying" claims as in they were impossible, however he made a ton of claims that would put his language on par with languages with huge teams of people, several with major companies backing them, with far more resources.

It was like, really? You're going to have all these features that teams of engineers have been working on for decades (in many cases)? And do them flawlessly? You're also going to beat Zig, Nim, and Go - in far less time?

I've got no problem with projects like this for fun, but it's being marketed as a full fledge project.

Re:The V Programming Language by c-cube on Tuesday September 15, 2020 @12:26PM (#24483139)
There was at least the CS defying claim of "no GC, no leaks, simpler than rust" (I'm paraphrasing, but it was along these lines). Sounds easy when you just write it as a checkbox on a list of exciting features.
Re:The V Programming Language by delian66 on Tuesday September 15, 2020 @03:16PM (#24485522)
There is no GC, and the language is indeed simpler than rust.

The "only" thing missing for now is "no leaks", but we are working on it.

You may be interested in https://aardappel.github.io/lobster/memory_management.html .

Re:The V Programming Language by vlang1dot0 on Tuesday September 15, 2020 @03:44PM (#24485877)
> regarding lobster memory management:

> the scope of anonymous functions cannot outlive variables' scope they reference, however V plans full closure support

> lobster compiles whole codebase at once (so it can properly track data flow across module boundaries), however V plans incremental compilation support

> both points are direct consequence of lobster's choice for memory management, ie solving them would mean moving away from lobster's strategy as far as I undersand

https://github.com/vlang/v/issues/1247

Lobster's approach at least has some theoretical rigorousness to it. What V is doing is quite different both in terms of the implementation and the requirements from the language itself and they have never been shown how their version is sound.

Re:The V Programming Language by agumonkey on Tuesday September 15, 2020 @11:43AM (#24482543)
I still don't want to play with that because the author seems to insinuate that his language is the leanest fastest because it compiles to C as if he's not taking the C->native step.
Re:The V Programming Language by aidenn0 on Tuesday September 15, 2020 @11:57AM (#24482752)
TFA lists total time with clang and tcc backends. I believe it also has a beta quality x64 native backend now.
Re:The V Programming Language by azhenley on Tuesday September 15, 2020 @11:49AM (#24482633)
I believe part of it is that they were getting a lot of donations, probably based to some extent on those claims.
Re:The V Programming Language by axaxs on Tuesday September 15, 2020 @11:39AM (#24482501)
I remember this as well. My opinion is that both sides were in the wrong. I think it's a case where the creator is overambitious, and set unrealistic timelines that obviously weren't met. In response, many called him a scammer/vaporware because he's soliciting donations.

That said, the project kept progressing along and seems to get daily commits, which would be unusual for vaporware.

Re:The V Programming Language by higerordermap on Tuesday September 15, 2020 @11:51AM (#24482652)
I never mind that creator was ambitious. The problem is he made the claims as if they were implemented, without even knowing about the feasibility of them.

The creator of V also seems to lack knowledge of CS fundamentals and apparently thinking he can make a great language by retrofitting "missing features" into Go.

The language is an unfunny joke.

Re:The V Programming Language by Joker_vD on Tuesday September 15, 2020 @12:34PM (#24483232)
Well, I can definitely see why someone would want to add generics and less verbose error handling to Go.
Re:The V Programming Language by higerordermap on Tuesday September 15, 2020 @12:51PM (#24483443)
The word is retrofit.
Re:The V Programming Language by Joker_vD on Tuesday September 15, 2020 @01:04PM (#24483611)
I fail to get the distinction you're trying to make. "To retrofit", to my knowledge, means "to add a part to something that didn't have it originally". Is it supposed to be pejorative?
Re:The V Programming Language by kd0amg on Tuesday September 15, 2020 @02:15PM (#24484632)
Slightly pejorative in that it suggests a result that's less effective/streamlined/economical/whatever than had the new part been included (or at least accounted for as a possible extension) in the original design.