I Am Using Vlang in My Next Projects
In the recent decade a new programming language appears at least every six month, so usually I skip such news automatically considering that we already have quite a zoo of languages for any purpose (or lack of). From my perspective current state of the market is simple: there is one true general purpose language - C, and a few of industry specific defaults like JS, Python, Java, Go, etc. So first time I’ve heard about the Vlang I dissmised it, but when someone said that “V is actual C” it got my interest..
As you might guess I like Golang, I won’t ellaborate why - I am sure you’ve seen all my arguments before. All I can say - I enjoy its balance between simplicity and dev velocity. There’s also no much to say about Go’s type system or C interop. Yes, it sucks - so what? The fact is that when we have a task that requires something that is not in the standard lib, we usually fall back to C/C++, because most of the problems has already been solved in C and keep evolving in C. Yes, sometimes I have to marry Golang with NodeJS, and sometimes it is not pretty, but both share the same market and in some cases you just need to do it (especially in crypto projects).
Vlang
Vlang in its syntax, draws an inspiration from Golang and Rust. As the authors say - if you know Go you know the most of the V. Also Vlang introduces nice safeguards - no undefined, no globals, immutabilty by default, mandatory error checks, etc. But in my case what really sold it, is that Vlang compiles to C. Basically V leverages well polished C patterns in its runtime, so under the hood it is “just C”. You might say “So what? I’ve already seen such projects”, but let me say, I consider it the best strategy for such a language. Can they build their own compiler? - I am sure they can, but why not leverage existing ecosystem?
What Vlang provides is an ability to use C while leveraging best practices inspired by modern languages. This is the best selling point for myself, but I understand why it might be hard to sell for other developers. So I’ll try to explain my point.
So why I am investing time to learn V and plan to use it in production?
Well, if Vlang depended on its own compiler like Zig - I wouldn’t. If anything happens, it is almost imposisible for one developer to maintain the entire toolchain. But Vlang is a different story - it is just an AST plus a runtime that transpiles to C. If something went wrong with the language I’d just make my own backend. They already did a pretty good job on the build system so it won’t go anywhere.
The second point is simple - I like V’s development experience. It is comparable to Golang - compiles fast, clean syntax, powerful toolchain. It so happend that I just liked V approaches to language design as much as these things are always the matter of preference - they managed to keep it simple and flexible.
Other V’s features like different memory management strategies or upcoming concurrency model is something of the category “nice to have”, at least in my perspective. I am happy with GC and an option to turn it off when needed. As of Go’s concurrency model - in 95% cases it can be replaced with an event loop because the cases when you really need a 100 threads is just so rare. If you wanna offload a task from main thread once in a while you don’t really need goroutines - just spawn a thread or an event loop if you need NIO. This is why I consider V to have enough features to use it at present day.
And as a final thought. I also see that V’s team cares about the language ecosystem. They provide an ORM, GUI and a reach stdlib. Because of C-iterop I would use V anyway, but it’s nice when such things taken care of by the language’s stdlib.
Where would I use Vlang?
Currently my day job and my main stack revolves around NodeJS. However, my idea is to use node as a server/event loop and write business logics in another language. My main bet was Golang, but say what you want - in my opinion it will never be a general purpose language, however V might already be exactly that. Let’s imagine that in a couple of years I might need to do something on system level or build a peace of my codebase for a new fancy architecture - I think V would be the right choice.
Peace ✌️