197 points · by zdw · 6y ago · 70 comments
I can see that very much unlike Futhark, Rust-GPU is deeply graphics focused, but I argue that a very similar language can be made to accomodate if not all then most shader-specific things. In which case, Futhark would be a very good place to start.
It could be the rayon of GPU computing on Rust.
Don't mistake winning a few battles with winning the war.
So far C++ hasn't had much foothold on kernels and embedded, despite several victories.
Also note that NVIDIA is on ISO C++ and they have changed CUDA architecture to fit C++11 memory model.
Second, the connectivity was not the same at the time, ideas travel much faster now.
C was born in 1972, so 48 years.
C++ was born in 1985, so 35 years.
I stand corrected on the matter.
As for ideas, traveling is not enough when at the reception end there isn't any willingness to accept them.
Rust is a bigger language.
There are other languages aiming to be small and a better c. Zig comes to mind.
Simplicity is a feature, and one that C++ aggressively avoids.
P.S. According to hackernews filter bubble, Lisp should have killed Java decades ago.
* Rust is no harder to learn well than C, as someone else has already commented.
* Rust compiling too slowly is just an attribute of its current implementation — there's nothing about the language itself that makes it any slower at compilation than, say, C++.
* C interop isn't hard at all in my experience. Do you have any particular complaints?
* it's no less safe than VM-based languages. In fact, given the guarantees it gives you wrt parallelism, I'd say it's more safe than most VM-based languages.
Two points here. One, a comparison to C++ is a little disingenuous because C++ is notorious for slow compile times already. Two, it’s not really accurate to say that Rusts compile time is an implementation detail. In fact, many times over the lifetime of Rust the Rust developers have traded off compile time for particular features that they wanted to add. Compare this to, say, Go, which refuses to add any feature without a serious consideration of compile time impact. Sure, the current implementation could be sped up - but it certainly wasn’t designed to be.
My experience is the opposite of this. Back when dinosaurs walked the earth, I moved from one system language (Ada) to C and, in a couple of months, I was writing device drivers. I have struggled with Rust on hobby projects for a few years and have given it up 3 times -- this is despite having 18 years of C++ experience.
I would not say that you are wrong, just that this statement about the learning curve is not true for everyone.
https://pingcap.com/blog/rust-compilation-model-calamity
https://pingcap.com/blog/generics-and-compile-time-in-rust
> Do you have any particular complaints?
It's same issue as in C# and many others: someone has to write and support the bindings, which adds cost.
> it's no less safe than VM-based languages
In VM-based languages which don't use unsafe code, vulnerabilities like this are impossible by design: https://medium.com/@shnatsel/how-rusts-standard-library-was-...
We have already learned to scale down from threads and go back to processes for security and stability reasons.
Here Rust doesn't help across IPC and data races of external resources.
One way that Rust compiles way slower than C++ is its Gentoo approach to libraries. With C++ I only compile my own code.
To prove how hard it is to replace C, even Microsoft with its security speech and "we don't need C on Windows" has given up to market pressure.
The Azure Sphere device whose marketing message is all about secure IoT, uses C as its only language, despite endless requests for C++, Rust, C# support.
The new MSVC version will support C11 and C17, minus the C99 features that became optional in C11.
Language evangelism without market understanding doesn't go far.
C might not be perfect but it's clearly perfectly possible to write stable and secure programs in them.
1. Not all software is exposed to internets, or requires many 9-s in reliability like avionics. A videogame that crashes their hardware-virtualized compartment on 1 out of 100k consoles is not OK, but might be good enough in practice if the unlucky users are refunded.
2. We have higher-level languages which solve these vulnerabilities for acceptable performance cost, and even easier to learn than C.
Complaints about Rust's learning curve is something I really do not get.
Yes, it forces you do actually think of what you're doing, which most devs seem to consider a Bad Thing™, but in the mid to long run it helps one enormously and it's one of the first languages of the last 30 years which actually makes lots of things better as a whole, while not being in a walled closed ecosystem.
> compiles too slow
There's definitively room for improvement here, but honestly, it's way faster than most C++ projects, and the fact that I have native support for nicely separating stuff in sub crates or workspaces, which dramatically improve iterative compiling, makes this a non-issue as long as one does not dump everything together as a pig pile.
> hard to interop with C
This is just plain wrong, it's very easy to interop with C - we're doing so with some projects, among other a library interoperating with QEMU, where the rust stuff is async (using tokio) and we can nicely integrate this into the C code of QEMU. Automatic binding generation allows you to do this quickly, albeit not very idiomatic most of the time. But manual binding generation is seldom hard, either already done on more popular stuff or one time cost, which, if one knows the code they want to bind too (they should) is rather small.
> less safe than VM-based languages
Hardly so. One is much more exposed to dynamic runtime errors in those, GC is a PITA and the VM is normally not safer than the rust std lib, as most of it is written in safe rust already and is around, battle tested for up to 5 or even 10 years.
I've been programming C++ for living since 2000, recently it's C++/17. I think I have good understanding how software works in general, including heap and ownership. Tried to use Rust a couple times for hobby project, failed for various reasons. I don't have issues picking other languages: VBScript, C#, Objective C, Python, Go had little to no learning curve.
Another evidence in this thread: https://news.ycombinator.com/item?id=24878434
> while not being in a walled closed ecosystem.
Wasn't always the case, but .NET is open, thanks to competition. Python always was.
> it's very easy to interop with C
It's equally easy and almost as efficient in C#. The issue with both, someone has to write and then support the bindings. This ain't hard but has costs, while languages like C++ or Objective-C can directly consume C libraries.
It seems this is only for shaders, but if that’s the case one has been able to use shaders with Rust via GLSL since forever.