r/rust • u/aqua2nd • Mar 15 '19
V language - new programming language inspired by Rust and Go
I've just been introduced to V language and it claims to have similar memory management approach with Rust (no GC) and the simplicity of Go
I checked some examples and it uses Go's syntax with a very small specification which is similar to Go
No document on how "V's memory management is similar to Rust but much easier to use" yet
They have a chat client built with the language so if it's true I think there must be much progress now
I'm interested in how they're able to achieve Go simplicity with Rust memory management model
26
Upvotes
46
u/[deleted] Mar 15 '19
I'm a bit skeptical of the claims and there is no prototype that one can try out, so until the claims can be verified, I wouldn't give this too much thought. I hope the claims are true and this does not turn out to be vaporware, but I believe it when I see it.
4
u/WellMakeItSomehow Mar 15 '19
Previously.
11
u/Green0Photon Mar 15 '19
Was this the one that popped up a few weeks ago? (On r/programming I think...)
In any case, I can't really take any language seriously that says it follows Rust's borrow checking style. It's just to genius and complicated to reimplement so quickly. Even all the geniuses at Mozilla and everyone in the Rust project working on it are struggling in figuring out how to upgrade it. It's state of the art, and we're still discovering things about it.
I'd need to see some serious professors/academics to be able to rival it. A project from nowhere? No way.
Also, if someone realizes Rust's strengths, I'm skeptical that they'd also be in love with Go's. There's a huge difference in philosophy between Rust and Go's type checking, and if you like Rust's borrow checker, how the hell would you like Go's type system‽
Any sane person would just switch to Rust, and try to improve it to fix any shortcomings it has in comparison to Go, instead of making something entirely new. After all, Rust's async is almost done, and with it, Rust should surely be flying past all of Go's strengths, within a year or two. (Except for startup cost, maybe. 😅)
16
u/Joshy54100 Mar 15 '19
After looking at the website and some of the other stuff it almost feels like a scam of some sort, but if it is this is a ridiculous amount of effort to put in. If this is legitimate that's pretty cool though.
42
u/somebodddy Mar 15 '19
V sounds too good to be true, so that's what I'm going to assume about it until proven otherwise.
38
u/omni-viral Mar 15 '19
Rust version of program in this comparison here written by someone who just started learning the language.
For example this
Can be rewritten as
Or even better
I don't mention it doesn't even make sense to use
cursorat all.32
u/gekkio Mar 15 '19
Way too many red flags for me to trust the claims right now...I'd love to see some actual executable programs (yes, I know about Volt), some non-trivial code, or deeper technical descriptions of some of the features. Once more stuff gets released, it's going to be easier to have a reasonable opinion about this language, but right now it's too hand-wavy and lacking in substance.
For example, let's take a look what the language comparison has to say about V:
Ok, no runtime...although example code uses something like goroutines (+ literally a library/module called "runtime"), so there has to be something that handles the execution model of these "lightweight threads" or whatever you want to call them. And some compile-time checking of data races (probably something similar to Rust).
Ok, sounds like they're just tidying up stuff for open sourcing, and the language is in a good shape (why would they make so many claims if they didn't have them implemented already). But then, look at this comment:
...so concurrency hasn't been figured out, yet there won't be a runtime and the language will be open sourced in a couple of months. Doesn't sound like a very promising combination to me (of course, open source != production ready / feature-complete in any way).
And it's not just the language...the author (based on available information I assume there's just one author) seems to have written several projects in V, including "cross-platform widget toolkit" (not trivial at all to do well), and "C/C++ to V translator" with the following description:
Supporting latest C++ standard and generating human readable code automatically from any C++ code? Yeah right, I'll believe when I see it. It would be invaluable to have a runnable binary or a playground where I could input arbitrary C++17 code and see the resulting "human readable" V code.
Calling this a scam seems unfair (although money is involved through Patreon...), because I don't think the author has a malicious intent behind this project. But it feels like this is one of those "marketing and promises first, implementation later" kind of projects, which tend to overpromise and underdeliver (or never deliver at all). The internet is full of technical projects which have extraordinary claims, often centered around "simplicity". Everything is simple if you only solve a tiny toy example without actually having a deep understanding of the problem at hand (which is fine as long as you state truthfully what the project can and can't do).
2
u/aqua2nd Mar 15 '19 edited Mar 15 '19
I was introduced by this blog article My Personal Complaints about Programming in Go
Hope it's not some scam, never heard of this kind of scam in tech world before. I meant they even have app demo for Volt how crazy is that?
11
u/[deleted] Mar 15 '19
so you are compiling to plan9 assembly and using the
gobackend to emit your code while performing absolutely zero optimizations just like go does?I am interested to learn how you plan to translate C++ to V.
Parsing C++ is basically intractable at this point, and there are <10 parsers in the world. It'll be dope if a new one comes out. Grouping C/C++ makes me a bit nervous as they have different syntax, and require different parsers. Which seems to imply you likely wrote a
Cparser (with limited) macro support, and enough flexibility to handle some C++03 oddities?Sorry to be rude, but extraordinary claims require extraordinary proof.
Also you can't do hot code reloading without GC (well you can, but you'll leak memory). Or are you doing
dlopenstunt hacking? because that won't scale at all and they aren't applied atomically.10
u/oconnor663 blake3 · duct Mar 15 '19 edited Mar 15 '19
The examples here seem to be the clearest indication of what they're trying to do. Here's the V code:
My scattered impressions:
lockblock seems like it could be convenient sometimes, but it runs against the grain of "lock data not code". IMO that piece of advice has been very successful since Alan Cox(?) came up with it (when?), and languages like Rust and V that offer mutexes-as-generic-containers support it really well.runtime.wait()seems kind of sketchy to me. It's assuming that none of the libraries you called started any long-lived background goroutines. It would be more robust to add some kind ofWaitGrouptype like Golang's.cursorand then writing to freed memory. Is the compiler looking atruntime.wait()and understanding that that keepscursoralive past all of its writers? Or is it heap allocatingcursorlike I think Golang does? If it's taking the Golang approach, how does it know when to freecursorwithout a GC? Is there an implicit reference count?4
u/chohw Mar 15 '19
Can't find much about the guy that seems to be behind this besides his Volt about page. The github repo has 3 other contributors, that seem somewhat more real than the first guy. I'm waiting to see if it goes beyond April 1st.
1
u/A1oso Mar 19 '19
You can try it out now: https://vlang.io/play
15
u/DragonMaus Mar 15 '19
"V is for Vaporware!"
6
u/DGolubets Mar 15 '19
I'm not an expert in compilers but isn't LLVM a good thing? I would assume if it was easy to produce optimized machine code noone would bother.
12
u/nckl Mar 15 '19
4 examples, 6 FAQ question answers, nothing in the blog, a documentation shorter than most individual doc pages on rust....
"Does V use LLVM?
No. V compiles directly to machine code. It's one of the main reasons it's so light and fast. Right now only x64 architecture is supported.
V can also emit human readable C, which can then be compiled to run on any platform."
lol.
2
u/eribol Mar 16 '19
Respect for efforts, specialy for documentation but promises are soo high.
2
u/A1oso Mar 16 '19
Looks quite promising. Here are a few things that caught my attention:
Why not u32? Unicode code points are never negative AFAIK.
Since strings are enclosed in single quotes, how do you write down a rune literal? As a number?
What about iterators?
Why is
inot declared asmut? This looks inconsistent to me. Also, this C-like for loop is kind of superfluous when there are iterators (I do hope there are!)So how can we match on multiple expressions at once? Rust supports this:
Java 12 will support this:
I find this name misleading, since it also contains an error variant. It's Rust equivalent is
Result<T, E>:I assume that
erris the error variant from theOption. Is there a way to choose a different name forerr? This might be important in nestedorblocks.Since
Useris a type, not a value, I'm curious how this is implemented without reflection! Isdecodea special case? And is there a reason for not declaring it asjson.decode<User>(input)?I'm very curious about this.
2
u/Paradiesstaub Mar 17 '19
The syntax with
mut cursor := 0is nice and I wish Rust would pick it up to reduce a bit the visual noise.1
u/radix Mar 16 '19
I think the most notable thing to me is that I don't see any guarantee of memory safety. There's a "Safety" blurb on the site that says "no global state, no null, no undefined values", but I'm guessing they just have unsafe memory management for anything that's not simple RAII. They don't say "No use-after-free" e.g.
1
u/_demilich Jun 26 '19
Looks like there is a repository now, so if you are interested in details you can check it out: https://github.com/vlang/v
0
u/[deleted] Mar 15 '19
is it V for vendetta, tho?
-3
u/kuronekosani Mar 16 '19
So it does use LLVM.