AFAICT this does not really use Rust, or the Rust type system at all.
This is just a procedural macro that parses "Rust-like" syntax into an AST, and then 1:1 fold that AST into OpenCL. This AST is not type checked, and if you were to, for example, replace the usage of an `u32` in there with a `type U32 = u32;` then parsing will probably fail, because the proc macro doesn't know what `U32` means.
The OpenCL code that gets dumped into a byte string, is compiled at run-time by your graphics driver. The proc macro can probably, at best, try to verify that it is correct at compile-time, by passing the dump to some OpenCL verification tool, but it does not appear to be doing that right now.
A bit off-topic, but it seems articles with "in Rust" or "in Go" tacked on the end are consistently upvoted to the front-page. I wonder how well this reflects actual usage of the languages Rust and Go...
The front page isn't an indicator of usage, it's an indicator of interest, and specifically the interest of the type of people that read HN. I don't think it's a stretch to say that Rust seems to have garnered the interest of a lot of those types of people, whether or not they are currently using it.
It doesn't. As a freelancer if I type "rust" on upwork right now I get only 26 jobs. If I type "golang" it yelds 104 jobs. But if I type "php" I get 7966 jobs; "java" = 2547 jobs; C# = 1174 jobs. Even "Assembler" gives 292 results, more then double of both rust + golang combined. For me Rust / Golang / Swift are those Instagram "influencers" that the press talk a lot about it but have little power in the harsh reality of the world.
Swift is 5 years old and yields more results then rust who is 8 years old. You know you have a good one when it picks up and just goes. All of them 3, poor Rust is the most talked about in HN and yet is the least used in real world.
As for upwork skewing, you really have no idea what upwork is. They have absolutely zero interest to hide results as their money comes from those jobs people get hired for. So why would they cut their own revenue?
It's not about Upwork intentionally skewing the results as you pointed out, but that there is a potentially sampling bias. Upwork might only attract certain kinds of programming jobs and those are less likely to use Go and Rust.
Except it doesn't work like that at all. In there you have real problems from real people who want the job done. If their problem requires Rust, then trust me, they will ask for Rust. And those are the people who pay the freelancers. As a freelancer I have zero saying in what clients want, I am there to help with their problems, not for them to bow before my choice of programming languages.
Rust inspired Swift heavily. I kinda don't care about Google results. All the big companies are doing something with Rust. Microsoft is doing actix and wants to use rust for IOT, Apple is trying to make Swift more like Rust, Google supports Rust on Fuchsia as a first class language etc.
I didn't say that upwork is skewing it intentionally, I'm saying that the samples aren't representative of the larger population.
And as a freelancer I don't care what company X or company Y does internally. I care only about the jobs I can get. When enough of them will start having problems in Rust and start posting jobs for outside world then maybe I will care about Rust too.
Yeah, I know, I'm an a*hole for not loving Rust from 1st second, sorry for caring about my family first and not enough about Rust. </sarcasm>
And? Upwork's and HN's crowd are not similar in the statistics sense, the vast majority of Upwork users are not necessarily on HN. On top of that, Upworks's numbers represent the business requirements of enterprises, also has nothing to do what software engineers like.
If actual usage reflected front page position we’d all be talking about C, C#, JAVA or PHP.
I follow a few job agents because I do part time work as an examiner for applied CS students, and I occasionally advice on what languages they should teach to make sure their students are job ready, and nothing has really changed for a decade. Python demand is really the only area that has seen a real increase, but not for developers as you need some sort of degree in either statistics or math to get the ML/BI jobs.
It’s always a little sad to see students who spend a lot of time buying into the hype and building their final projects in something like Rust or Go and before that node/express. Because they’ll have a much harder time finding a job than the ones who didn’t do that. Not because learning Rust is bad, but because it’s safer (and cheaper) to chose their competition and it’s not like there is really a lack of freshly educated developers anymore.
Rust is very unpopular. Popular being besides the usual suspects Assembly, Visual Basic, Delphi, Objective C , Swift etc. Finding the popularity of a language is actually pretty easy, ignore all the blog posts and opinion pieces of any kind and focus on third party libraries availability, documentation and benchmarks. Even on benchmarks Rust score very low making its “as fast as C” claim speculative to say the least. Strictness of a Rust also makes it highly unlikely that the language will become popular any time soon. Judging from the fact that innovation of any kind is one big reason for users to stay as far away as possible, even if that innovation ends up being part of all programming languages out there. Explains why innovation has stagnate the last century in software. So my rule of thumb is “if many people talk about it then most likely it’s popular if a ton of people talk about then it’s most likely unpopular”. So it’s definetly an indicator in a bell like curve.
If you mean unpopular in the sense that it’s unlikely it would end up being used for your “average” project I think you’re right. However it’s seeing uptake in key systems programming projects. The most notable is probably Amazon’s Firecracker VMM that underlies AWS Lambda and Fargate. Google is also writing some components of their new Fuschia OS in it.
And Rust is used in various parts of Firefox now. Dropbox uses Rust in their Magic Pocket storage backend. npm uses Rust in its registry service.
Sure, Rust is not going to replace Java anytime soon (probably not at all). But for a language that has seen its first stable release only four years ago [1], Rust is a wildly successful systems programming language.
[1] Before Rust 1.0, Rust was not really usable in production due to very frequent changes to the language.
Rust 1.0 wasn't even that stable or usable in production, albeit it is of course forward-compatible. NLL (introduced with Rust 2018) was a huge improvement in overall usability, and it's likely that we'll see even more such changes in areas such as async. Rust is quite far from true "maturity" in the C/Java/PHP sense.
Comparing a young language like rust to much older popular languages is not a useful comparison.
I'd say given Rust's age it's popular, and since it is the first contender for a lot of spaces where no other languages have made a serious bid in a while (embedded and real-time systems with higher safety guarantees haven't seen much love since ADA).
It will probably not supplant easy super popular languages like python. But I believe it might find it's niche. A lot of other languages don't have such a USP.
> It will probably not supplant easy super popular languages like python. But I believe it might find it's niche.
Yea, I definitely don't think it'll ever be as hugely mainstream as "easy" languages - take Go for instance, but it has huge potential and I'm a big fan of the language (I've switched entirely to it).
It may be possible that another language can come up with a more elegant solution for the memory safety features of Rust, but until that happens I think Rust will gain a lot of ground. It just won't be the language people turn to unless they have a use case explicitly for Rust (or rather, something that disqualifies Go/Python/etc to them).
It seems the purpose of rust would be to use the borrow checker for safe compilation, but this is all in a macro? So the value add of rust here is the good macro system?
Rust GPU iterators based on a Futhark like approach are one of my dreams (a sort of GPU equivalent for Rayon).
The Rust community is used to high level functions via the iterator abstraction and wants high performance : it seems like a perfect match.
If you want to snack on some Futhark code along with the docs, the Advent of Code solutions (linked from https://futhark-lang.org/blog/2018-12-25-futhark-0.8.1-relea...) might be a good place to start. I liked them because they include problems that are not good fit for Futhark, so it documents how to think about the applicability as well.
1. What exact syntactic differences does this have from rust, and why?
Some differences I see are in function definitions: lack of `fn` keyword, `->` for function return type, and colons for parameter types.
2. How does this make use of the borrow-checker, if at all?
3. Who is the target audience? Is it meant for general mathematical acceleration or graphics?
It seems to be meant for scientific purposes, seeing as it provides a system of units and constants.