News for hackers. Stuff that matters.
Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:17AM (#26511368)
I think Rust's biggest threat is that it's repeating the same mistakes C++ did, despite the hindsight. C++ tried to be everything for everyone -- a language elaborate enough to write applications in a style that appears high-level on the page, and yet not give up on the full control required for low-level programming. For a while, it worked. The problems only became apparent some years later, when large applications had to be maintained, and people realised that low-level languages, no matter how high-level-looking, all make a certain sacrifice: low abstraction. Clients of components are sensitive to implementation details of those components, and so the maintenance of applications costs as much as that of low-level code does. OTOH, the complexity of the language made portability hard (low-level code is often written for custom hardware) and also hard to analyse. C continued to dominate the embedded space, the application space went to true high-level languages, and C++ kept an intermediate, though important niche, of games and software platforms for capable-enough hardware, which it firmly holds on to.

Rust is now doing the same. Few in the embedded space find it appealing, many of those who use C++ do (as it is certainly a cleaned-up C++, and a nice improvement in comparison), but too often not appealing enough to switch now, and some in the application space who don't know or don't remember the C++ lesson do adopt it now (sometimes out of sheer novelty) but will likely abandon it later for similar reasons C++ was largely abandoned in that space. So it is really competing for a pretty small and conservative niche -- albeit an important one -- and one with a strong incumbent. If it does very well, in 20 years we might find that 60% of the C++ space has switched over to Rust, and that's about it.

What Rust needs is focus, but it won't have it because I think some of its designers still believe in what C++ believed. That you can have a language that is both high-level and low-level, with the benefits of both and the downsides of neither.So it's being pulled in multiple directions, all while showing poor performance in the market (C++, at least, wasn't just hyped but actually popular). It's not even going after C++'s market seriously, but after the nonexistent market C++ thought it could occupy; the only market it seems to be actually competing over and doing well in is HN-front-page real-estate, the space formerly occupied by Ruby and Haskell. When I was at University in the late '90s, everyone was talking about Haskell will be the language of the future. With almost constant levels of hype, more than twenty years later, it still is. It turns out that for various reasons, when it comes to programming languages, hype and market performance can be completely out of sync for decades. Rust's designers need to choose between adoration and actual popularity. The latter will require some tough decisions. If it's going after the C++ market, it should make itself extremely appealing, irresistibly so, to C++ programmers.

Re:The biggest threat to Rust's sustainability by jgilias on Friday March 19, 2021 @05:44AM (#26511527)
I've done my share of C++ and now Rust, and I don't really get why people keep saying that Rust is a 'cleaned-up C++'. In my opinion this couldn't be further from my subjective truth. I see C++ as an effort to extend C to enable object oriented programming patterns. And everything else being added to it as more and more people have come to appreciate patterns from other programming paradigms. But fundamentally C++ to me is still 'C with classes'.

Whereas Rust, to me at least, is 'ML-ish with curly braces'. So, a language firmly based in the ML heritage with C-like syntax. So, fundamentally working with types and 'typeclasses' and heavily leaning towards filter/map/fold/reduce/lift/unlift type of thinking. Sure, throwing funtions around as first class objects are not as easy or straightforward as it is in 'real FP' languages, but that's a trade-off I'm willing to take for the guarantees that Rust provides.

I'm genuinely curious what's the reasoning behind being able to assert that 'Rust is a cleaned-up C++'.

Re:The biggest threat to Rust's sustainability by floatboth on Friday March 19, 2021 @06:42AM (#26511859)
Rust is rather more like "Haskell-ish C++". (Typeclasses were popularized by Haskell and are not available in SML or OCaml.) While the C++ heritage is obviously the memory management – no runtime, heavy use of scope based deterministic destruction ("RAII"). Also the compile-time metaprogramming that gets monomorphized. (All those template/generic instantiations that can bloat the binaries if overused :D)
Re:The biggest threat to Rust's sustainability by Zababa on Friday March 19, 2021 @08:11AM (#26512352)
For reference, here's the "influences" page of the Rust reference: https://doc.rust-lang.org/reference/influences.html

SML, OCaml, C++ and Haskell are all mentionned.

Re:The biggest threat to Rust's sustainability by jgilias on Friday March 19, 2021 @06:54AM (#26511909)
I've been bashed before for saying something along the lines of "Haskell-ish C++". Their fair point being that the only Haskell influence is the typeclasses, and all other ML-influences are just ML-influences that are not unique to Haskell. Fair enough :)
Re:The biggest threat to Rust's sustainability by TinkersW on Friday March 19, 2021 @06:11AM (#26511685)
Have you not seen much modern C++? If you are used to this style of C++, Rust is a very obvious variant of it, but with more static guarantees with regards to safety. Working heavily with types has been common in C++ for a couple decades now, and there are libraries with bring in filter/map/fold/reduce/lift/unlift style.
Re:The biggest threat to Rust's sustainability by jgilias on Friday March 19, 2021 @06:22AM (#26511750)
The code I've had to work with was definitely more on the OOP paradigm side. Can you provide an example project with a more 'modern' C++ code base that I could check out?
Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:57AM (#26511606)
You're doing the comparison from the bottom-up, perhaps like how a programming language connoisseur would look at them -- how the linguistic features of C++ and Rust were constructed -- while I'm looking at them from the top down, how just a programmer who doesn't particularly care about PL theory would: what is their design philosophy? Both are low-level languages (so, low-abstraction), which try hard through various syntactical techniques and a nice dose of implicitness to make code, once written, appear high-level on the page. I find those two languages almost indistinguishable in terms of "feel." It doesn't feel like Python, it doesn't feel like Java or Go, and it doesn't feel like C; it feels like C++.
Re:The biggest threat to Rust's sustainability by jgilias on Friday March 19, 2021 @06:46AM (#26511878)
I do agree that Rust 'feels' more like C++ than Python or Java. But then, from my limited experience with dabbling into Haskell, to me it feels more like Haskell than C++. In Rust, from the language perspective, I have to deal with things like these:

- Doing Option<T> -> Option<U>

- At what point do I do Option<T> -> Result<T>

- Should I transpose Vec<Option<T>> to Option<Vec<T>> now or later?

- Often reaching for algebraic data types

- How to map over this to collect it into what I need

- Ah, it needs to implement Hash, Eq, PartialEq ... SomeTrait to make it work the way I want

- Pattern matching all over the place

All of which to me mentally feels more like something along the lines of F#, OCaml or Haskell than C++ that 'normal people write'.

Re:The biggest threat to Rust's sustainability by golergka on Friday March 19, 2021 @06:07AM (#26511662)
Because people know C++ but don't know ML.
Re:The biggest threat to Rust's sustainability by pjmlp on Friday March 19, 2021 @09:57AM (#26513363)
Depends on the people.

When I did my degree, C++ was taught in the second year and Caml Light in the third.

Re:The biggest threat to Rust's sustainability by carapace on Friday March 19, 2021 @10:45AM (#26513904)
It's like C++ is a gas-powered chainsaw and Rust is a newfangled electric "smart" chainsaw.
Re:The biggest threat to Rust's sustainability by steveklabnik on Friday March 19, 2021 @11:02AM (#26514114)
I often use "table saw" when making this sort of analogy, because there's even a more direct comparison: https://www.sawstop.com/
Re:The biggest threat to Rust's sustainability by carapace on Friday March 19, 2021 @02:30PM (#26516804)
(As an aside, WOW! What a great invention! The folks who sent in pictures of their tiny cuts (instead of severed fingers) nearly made me cry.)

That's a brilliant metaphor to drive home the safety advantages of Rust! "It's a table saw that won't chop off your fingers!"

That's a "shut up and take my money" proposition. (And it helps that it's a really good table saw too.)

(As another aside, I got to the testimonial from an employer talking about the peace of mind of knowing the workers on the shop floor are safe and it "clicked" for me: you've got metrics and liability for job site safety so you can quantify that peace of mind. We still not there with software quality liability eh?)

Re:The biggest threat to Rust's sustainability by wealthyyy on Friday March 19, 2021 @05:27PM (#26518292)
Reminds me that unprofitable hotness electric car company whose core business is to manipulate both balance sheet and government.
Re:The biggest threat to Rust's sustainability by jcelerier on Friday March 19, 2021 @05:41AM (#26511508)
> I think Rust's biggest threat is that it's repeating the same mistakes C++ did, despite the hindsight. C++ tried to be everything for everyone -- a language elaborate enough to write applications in a style that appears high-level on the page, and yet not give up on the full control required for low-level programming. For a while, it worked.

... and... doesn't it still work ? An awful lot of C++ applications are being written today, and that can be done at a pretty high abstraction level thanks to the type-level facilities of C++.

> . Few in the embedded space find it appealing, many of those who use C++ do (as it is certainly a cleaned-up C++, and a nice improvement in comparison), but too often not appealing enough to switch now, and some in the application space who don't know or don't remember the C++ lesson do adopt it now (sometimes out of sheer novelty) but will likely abandon it later for similar reasons C++ was largely abandoned in that space.

are we talking about the same embedded? most C shop migrate to C++. most car brands, and a lot of appliances, use Qt for their UI (C++)

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:52AM (#26511576)
> An awful lot of C++ applications are being written today

C++ is nowhere near as dominant in the application space as it was in the early nineties. "An awful lot" in nominal terms for sure.

> are we talking about the same embedded?

Probably not. C++'s niche is "low-level with capable hardware." Some "embedded" software does actually run on very capable hardware.

Re:The biggest threat to Rust's sustainability by batty_alex on Friday March 19, 2021 @06:44AM (#26511868)
> C++ is nowhere near as dominant in that space as it was in the early nineties.

You’re rewriting history here, friend.

Hardly anyone was writing embedded C++ in the 90s. Even nowadays I bump elbows with Developers that refuse to make the move from C in embedded.

If we’re talking Desktop apps, well... yeah, Windows was the new hotness, OOP was hot ‘n fresh, and Visual C++ was a BFD. Once more languages came about, people found ones they preferred over C++ (Java was a BFD).

As to your last comment, I’m guessing you haven’t worked in the embedded space with C++ if that is your conclusion

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @07:56AM (#26512256)
> Hardly anyone was writing embedded C++ in the 90s.

I wasn't talking about embedded in that section, but about applications, and not just desktop.

> Once more languages came about, people found ones they preferred over C++

High-level languages were used a lot before, like VB and other RAD languages. But the belief was that they'd be too slow for many applications, like servers.

> As to your last comment, I’m guessing you haven’t worked in the embedded space with C++ if that is your conclusion

That is correct, and yet the lower the hardware capabilities and the higher the required safety, you see more C and less C++.

Re:The biggest threat to Rust's sustainability by jcelerier on Friday March 19, 2021 @05:56AM (#26511598)
> C++'s niche is "low-level with capable hardware."

what do you call "capable" ? C++ is routinely used on atmega328, a 16mhz uc with 2kb of ram.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:58AM (#26511615)
The lower the capabilities, the less dominant C++ is, however routinely it is used in absolute terms.
Re:The biggest threat to Rust's sustainability by caskstrength on Friday March 19, 2021 @08:04AM (#26512301)
> Rust's designers need to choose between adoration and actual popularity. The latter will require some tough decisions. If it's going after the C++ market, it should make itself extremely appealing, irresistibly so, to C++ programmers.

And what decisions would that be? Your post seems self contradictory to me because it implies that Rust is both too "low abstraction" to be "extremely appealing" to C++ crowd, and too complex and "hard to analyze" to displace C in use-cases that require portability and/or are resource constrained.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @08:22AM (#26512428)
I didn't say it's too low abstraction to appeal to C++ programmers; Rust and C++ (and Ada, and Zig) have the same level of abstraction. I'm saying that Rust should seriously fight for the market C++ was able to actually carve out, rather than the market C++ dreamed it could have when it first gained traction. Doubly so because Rust is starting at a disadvantage compared to what C++ had: C++ already exists, and many people already know that a language that looks high-level but isn't, doesn't have the same maintenance costs as actual high-level languages. If it doesn't focus, what will happen is that it won't capture enough C++ people, and instead, it will get many people who didn't learn C++'s lesson, who will use Rust for some years and then abandon it -- just as happened to C++ -- and then it will be left with not much; it will have too little of the C++ market and too little of the applications market.

If there's anything we can learn from programming languages -- be they C, C++, Ruby, PHP, Haskell, or Java -- riding the hype-train led by PL enthusiasts and early-adopters is not a good recipe for long-term success (even if it is a good recipe for long-term hype). Like with fashion (and I think HN is more like GQ or Vogue than actual industry news; i.e. it is more aspirational and inspirational than descriptive or prescriptive), the languages people talk about and those they actually use for many years are usually not the same.

Re:The biggest threat to Rust's sustainability by nicoburns on Friday March 19, 2021 @09:05AM (#26512809)
> I'm saying that Rust should seriously fight for the market C++ was able to actually carve out, rather than the market C++ dreamed it could have when it first gained traction

That's exactly what Rust is doing. It used to have a runtime, green threads and a GC, but it doesn't because that's not what C++ developers want. And recent development work has been focussed on const generics and const fn which are both keys things seen as missing by C++ developers.

Re:The biggest threat to Rust's sustainability by caskstrength on Friday March 19, 2021 @11:28AM (#26514430)
What exactly do you mean by making "tough decisions", "fight for the market" and "make itself extremely appealing"? I've just re-read both of you messages in this thread and didn't find any single specific technical suggestion.
Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @12:15PM (#26515105)
That's because I don't know how to do that, and it might not be purely technical. But what Rust is doing doesn't seem to be working. Six years since 1.0 and almost unheard-of levels of hype, market penetration isn't even at 0.1%. It's a language with Python-level coverage and Elixir-level adoption.
Re:The biggest threat to Rust's sustainability by howinteresting on Friday March 19, 2021 @12:44PM (#26515487)
https://insights.stackoverflow.com/survey/2020#technology-pr... says that 4.8% of professional developers are using Rust.

From the perspective of someone who's been writing Rust professionally for the last few years, the hockey-stick curve started kicking in in late 2020 or so.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @03:00PM (#26517111)
Not at work. The sum of those numbers is 500%, and the average developer does not use five of those languages at work (If anyone does).
Re:The biggest threat to Rust's sustainability by howinteresting on Friday March 19, 2021 @03:04PM (#26517148)
Well, do you have evidence to support your claim that penetration is <0.1%? My impression is that it's simply not true now that most (if not all) of the FAANGs have many developers using it.
Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @03:27PM (#26517339)
It's from a November 2019 report by Indeed of 0.1% of job postings mentioning Rust (https://www.hiringlab.org/2019/11/19/todays-top-tech-skills/), with growth of 44% compared to 2018 (https://www.hiringlab.org/2019/11/26/fastest-rising-tech-ski...).

But you can even have a rough estimate according to your own measure. There are roughly between 50K and 100K developers working at FAANG (maybe replace Netflix with Microsoft). How many of them would you guess are using Rust?

Re:The biggest threat to Rust's sustainability by caskstrength on Friday March 19, 2021 @12:42PM (#26515458)
Well, yes, of course. Rust is not made by Apple, MS or Google who can just make it new "official" language on their platform and force adoption. Also, by its very nature (low-level-ish language without GC) it cannot have Python-level adoption in modern software development ecosystem.

Why would you want Rust to target lowest-common-denominator developers and become new VB or php? All it needs is enough momentum to become self-sufficient, which seems to be actually happening now with Rust Foundation and news of its usage in some major companies that can set the trends for whole industry (Amazon, Google, etc.).

Re:The biggest threat to Rust's sustainability by wealthyyy on Friday March 19, 2021 @05:39PM (#26518384)
> Why would you want Rust to target lowest-common-denominator developers and become new VB or php?

Rust wants not that I wants. It seems people replacing NodeJS with it.

Re:The biggest threat to Rust's sustainability by howinteresting on Friday March 19, 2021 @12:14PM (#26515092)
Could you please make specific claims here? Arguments that don't provide any examples are generally worse than useless.

I don't think Rust and C++ have the same level of abstraction, for example. Rust has ADTs and pattern matching, C++ only has product types and std::variant.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @12:44PM (#26515478)
Abstraction doesn't mean syntactic constructs. It means the ability to specify arbitrary aspects of behaviour and then provide interchangeable implementations of the behaviour. When abstractions can have more satisfying implementations, you have high abstraction; when they have less you have low abstraction (i.e. you can abstract only smaller groups of things). Replacing, say, a concrete type with a trait is about as much work in Rust as it is in Assembly. It's not a feature of Rust specifically, but of low-level programming. If you want control over object layout, placement, and lifetime, it means that you abstract over things with specific low-level details, so fewer things. This isn't a problem, but a tradeoff that low-level programming intentionally makes, that no syntax can erase.
Re:The biggest threat to Rust's sustainability by howinteresting on Friday March 19, 2021 @01:17PM (#26515877)
Yes and no. Let's drill down into this because the details are important.

There's a crucial distinction between input and output types in practice. For a given input type T, Rust makes it possible to abstract over `T`, `&T`, `Cow<'a, T>`, `Arc<T>` etc, by using a trait such as `impl AsRef<T>`.

However, Rust doesn't currently have existential types, so its ability to abstract over output types is more limited. You can implement, for example, `fn foo(&self) -> impl AsRef<T> + '_`, but you can't name that type. So if you want to return an enum, you can't write

```

enum MyEnum { MyT(impl AsRef<T>), MyU(impl AsRef<U>), }

```

Instead, you have to concretize the type somehow, either by boxing things up into a trait object (often but not always possible) or by exposing the generic param:

```

enum MyEnum<RefT, RefU> where RefT: AsRef<T>, MyU: Ref<U> { MyT(RefT), MyU(RefU), }

```

This is a real problem, though one that will be solved through existential types.

> Replacing, say, a concrete type with a trait is about as much work in Rust as it is in Assembly.

I'm not sure what you mean here. I'm not aware of any assembly languages which have traits. Replacing a concrete type with a trait tends to be pretty easy in Rust because mistakes are caught at compile time.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @02:44PM (#26516946)
I agree that existential types can increase the abstraction level, but not to the level of high-level languages (and they increase generated code-size), because in the end there are still specific low-level details a lot of code needs to care about, like storage and lifetime.

> I'm not aware of any assembly languages which have traits. Replacing a concrete type with a trait tends to be pretty easy in Rust because mistakes are caught at compile time.

I'm not thinking in terms of language features but abstractions. The best way to see this is to think how many different implementations to a code unit I can do without making the consumer aware? That number is significantly lower for low-level languages compared to high-level languages because things that can be hidden in high-level languages, like layout, storage and lifetime, must not be in low-level ones, hence "low abstraction." Changing something in one place is more likely to require changes elsewhere. Therefore, low-level programs are more rigid, more jigsaw-like, and their evolution more difficult.

It is true that a compiler that tells you if you missed a change helps a lot, but it doesn't change the nature of the low-level language, even though it improves its ergonomics (although it's not so simple, as sometimes even correct programs are rejected) -- you still need to do all the extra work, but it doesn't take quite as long.

Re:The biggest threat to Rust's sustainability by pjmlp on Friday March 19, 2021 @12:04PM (#26514951)
GPGPU, game engines middleware, and compiler research using LLVM have rejuvenated C++.

Additionally at least on Windows, Microsoft still believes in C++ for doing the kind of desktop applications you are talking about.

All these scenarios aren't properly covered by Rust in its current state, even the Rust/WinRT project is doing baby steps, very far away from what VC++ offers today.

Re:The biggest threat to Rust's sustainability by bluGill on Friday March 19, 2021 @03:30PM (#26517367)
Rust occupies a place that as a c++ developer is interesting. When someone says Ruby I think Python is good enough, I don't write a lot of the type of code where it is useful.

Haskell doesn't promise the type of control I need. Someone i work with rewrote our main control algorithm and proved it was correct (not in Haskell ,I just fear this problem ), but it took over a minute to run, and this PID loop needs to run at 5hz and leave some processor for other tasks. My c++ isn't proven correct but we have 15 years of production with it.

Rust promises to avoid some of the things we don't like about c++ while still worming in the real world. So of course I'm interested.

Re:The biggest threat to Rust's sustainability by zozbot234 on Friday March 19, 2021 @11:37AM (#26514568)
> For a while, it worked. The problems only became apparent some years later, when large applications had to be maintained, and people realised that low-level languages, no matter how high-level-looking, all make a certain sacrifice: low abstraction.

Not really; Rust is very careful to avoid leaky abstractions, compared to C++. It's definitely "low level" in a foundational sense (even reminiscent of C in many ways) but the limited "high-level" features it does have are incredibly solid and highly usable.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @12:08PM (#26515023)
For a given abstraction, think API, the number of correct implementations in Rust, C++, C and Assembly is roughly the same, and it is much lower than the number of correct implementations in, say, Python. That's what "low abstraction" means. The abstraction can be very precise with a rich type system like Rust's, but that doesn't make it any wider. This means that clients are just as sensitive to changes in implementation details, and that the cost of maintenance is high relative to high-level languages, even though the type checker can find the mistakes and tell you that the considerable work you may have to do is not done.
Re:The biggest threat to Rust's sustainability by tiddles on Friday March 19, 2021 @05:31AM (#26511449)
Maybe this is why Zig might end up being a better choice for embedded and very low level programming, as an explicit competitor to C.
Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @06:01AM (#26511630)
I have no idea what Zig might turn up to be. I like it a lot aesthetically, but it's far too early to tell what market adoption, if any, it will see. But at least its strategy is clearer: it ignores the (incidental?) "C++ niche" altogether, and says that there are only two categories, low and high, and it's going after low. This covers all of C and the majority (>75%) of the C++ space.
Re:The biggest threat to Rust's sustainability by diegocg on Friday March 19, 2021 @05:49AM (#26511563)
One of the things I often see in Rust is comparisons with C++

"It's simpler than C++!". Yeah, Rust could become a bloated mess and still be simpler than C++. It's like saying that a mountain is not high because it's smaller than the Everest. It's not a good idea to use C++ as reference.

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:53AM (#26511584)
I don't think it is contentious at all to say that C++, Ada, and Rust are all in the top five most complex languages in the history of software. All three tried to be low-level languages that appear high-level.
Re:The biggest threat to Rust's sustainability by littlestymaar on Friday March 19, 2021 @10:18AM (#26513621)
Complex is a poor adjective to talk about Rust: Rust is hard because there's one key concept one must learn before doing anything: ownership. And this concept (at least in the Rust incarnation) is completely alien, so you need to unlearn how to code before re-learning it the Rust way. This is hard and that's why Rust have a tough learning curve.

But Rust isn't complex: there aren't many features interacting in a special way with one another with a combinatorial explosion of interactions you need to know in order not to shoot yourself in the foot. (Move semantic difference between Rust and C++ are a good illustration of that).

Actually, in terms of number of different features you'll encounter when onboarding a new project, Rust is far behind JavaScript and PHP (PHP being the biggest example of how feature bloat doesn't kill a language, even if your language is targeted at inexperienced developers).

Re:The biggest threat to Rust's sustainability by carapace on Friday March 19, 2021 @10:59AM (#26514085)
In re: "complexity" of Rust here's something relevant and interesting that was on HN front page the other day:

"Why I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun" https://kevinlynagh.com/rust-zig/

In absence of good metrics for the kind of complexity we're trying to discuss I think we kind of have to rely on these sorts of first-person subjective reports from the field.

Re:The biggest threat to Rust's sustainability by dralley on Friday March 19, 2021 @03:44PM (#26517480)
There is a valid point here, which is that it's sometimes difficult to know what "the right thing to do" is in Rust, because it is a large language. I agree and can sympathize. I happen to like Zig also, FWIW.

But it does need to be said, that the approach he was using with Rust was absolutely not the right tool for the job. The author should have been using traits. That's what they're for, and they definitely aren't an obscure language feature.

Re:The biggest threat to Rust's sustainability by littlestymaar on Friday March 19, 2021 @04:23PM (#26517826)
This article has been extensively discussed here and on reddit, the authors faced a problem, did not seek help, and solved on his own it in a pretty convoluted way involving compile-time metaprogramming with macros. As pointed elsewhere, his problem is usually addressed using the type system (enums or traits). You can write a non-standard over-engineered solution to a problem with any programming language, that doesn't mean the language is complex. Zig being especially designed around compile-time meta-programming, it's not a surprise that the resulting code looks much more straightforward.

And that being said, the author mainly complains about features that also exist in C (macros and ifdef, and Rust's version are easier than the C one), would you call C a too complex language because it has macros and ifdef? (I actually think that C is one of the most complex programming language ever written because you need to store too much invariants in your head otherwise it's UB, but ifdef and macros aren't at stake )

Re:The biggest threat to Rust's sustainability by carapace on Saturday March 20, 2021 @10:31AM (#26523469)
You (and dralley) are missing the point: the dude made a wrong turn with Rust and didn't with Zig. You can blame the user all day long but at the end of the day what leverage Rust devs have is not in the user's head, eh?

- - - -

> I actually think that C is one of the most complex programming language ever written because you need to store too much invariants in your head otherwise it's UB, but ifdef and macros aren't at stake

Like I said, without metrics we're just trading subjective anecdotes.

Metrics for complexity of machines is a subject I find fascinating, ever since I read Ashby's "Introduction to Cybernetics" wherein he asks the question "How can we measure the complexity of a machine?" in the context of a formal system for describing machines (Cybernetics.)

There is also the concept of "Kolmogorov complexity" https://en.wikipedia.org/wiki/Kolmogorov_complexity

We could compare the sizes of compilers for C and Rust.

We could teach each to different randomized groups of students and see how quickly people learn to write (safe!) code in each.

Re:The biggest threat to Rust's sustainability by littlestymaar on Saturday March 20, 2021 @05:32PM (#26526207)
> the dude made a wrong turn with Rust and didn't with Zig.

Yes, this one guy made a wrong turn once. If you want to conclude from one user making a mistake that a language is complex then you're just going to conclude that programming is complex … Everyday, with every language under the sun, people make mistakes, great discovery.

I'm not blaming “the user®” here, I'm blaming the blog post writer who makes a mistake and concludes that his tool is responsible for it and that he should tell the world how bad the tool is.

> Like I said, without metrics we're just trading subjective anecdotes.

Well that sentence is pretty ironic given the previous one, nevermind.

> We could compare the sizes of compilers for C and Rust.

I wonder what conclusion you'd draw from such a comparison. That assembly is the least complex language in existence, followed by Brainfuck and Chicken?

> We could teach each to different randomized groups of students and see how quickly people learn to write (safe!) code in each.

Oh I actually like this one. For Rust, you'd need to run a study to find out, but for C the answer is trivial: Never. Nobody on earth know how to write safe C. Not even DJB, not even Theo de Raadt, or Richard Hipp, or Brad Spengler. For almost 50 years, the brightest minds of computer science have tried to write safe C code, and consistently failed. Can we conclude that this language is a little bit too complex for humans, or should we wait a few decades more?

Re:The biggest threat to Rust's sustainability by TinkersW on Friday March 19, 2021 @06:31AM (#26511801)
What I'd like is the ability to slowly switch newer parts of the codebase from C++ to Rust, with seamless interop between the two languages(IDE/Debugger/Profiler), but this is likely a pipe dream, and without this capability I doubt I'll be switching to Rust.
Re:The biggest threat to Rust's sustainability by gypsyharlot on Friday March 19, 2021 @05:59AM (#26511622)
Thank you for putting into words exactly how I feel about Rust.

I wish there was a C with a borrow-checker like Rust, but without everything else.

Re:The biggest threat to Rust's sustainability by alcover on Friday March 19, 2021 @05:35AM (#26511467)
Very interesting.

I guess the dream of a perfect low+high level language will never die.

You seem to imply that it's fundamentally impossible ?

Re:The biggest threat to Rust's sustainability by pron on Friday March 19, 2021 @05:50AM (#26511565)
I don't know if it's impossible. I don't believe it is possible, but even if it is, I think it's perfectly clear at this point that Rust isn't it.
Re:The biggest threat to Rust's sustainability by Ygg2 on Friday March 19, 2021 @05:33AM (#26511460)
Preface. I disagree.

I definitely don't get the feeling that C++ was that popular, I distintcly remember many Linus rants about it. It's just that after years of usage it carved its own niche.

However one pain point Rust does address is parallelism. If you want to use modern systems, and you're going with C++. Good luck. You're gonna need it.

As for the popularity, I think that's moot. But I do agree Rust can't be everything to everyone. One problem it will have for the forseable future, is the slow compile speed. But on the flip side, Rust has been super popular.

But it does one thing no other language does. Safe concurrency without GC. It's like a seatbelt in a car. Once you get used to it, you'll be paranoid its not there.

----

Where I do agree with article author was rate of change. IMO Pin should have never been added to standard library as it currently is. But async was rushed, for god knows what reasons.

Re:The biggest threat to Rust's sustainability by carols10cents on Friday March 19, 2021 @09:34AM (#26513100)
Async took years, burned out everyone involved, and many people complained about how long it took.
Re:The biggest threat to Rust's sustainability by Ygg2 on Friday March 19, 2021 @09:59AM (#26513379)
I know I am in the minority, but for me async is an anti-feature.

I'm not sure who is it for, but if it's responsible for Pin and it's related unsoundness issues, that just makes me dislike it even more.

A language with BDFL could have, took a more principled stance and said no async until we prove Pin is safe.

Re:The biggest threat to Rust's sustainability by steveklabnik on Friday March 19, 2021 @10:08AM (#26513486)
They could have said "we won't ship this yet," and they also could have said "ship it" to the initial design in 2015.

> took a more principled stance

This is very insulting. Bugs are often found in every kind of software. Virtually no languages that exist, let alone popular ones, require proofs before landing new features.

Re:The biggest threat to Rust's sustainability by Ygg2 on Friday March 19, 2021 @11:22AM (#26514348)
> This is very insulting. Bugs are often found in every kind of software.

To me it's not a bug. It's a foundational flaw. If Rust was a house, and a bug was a broken window, unsoundness issue would be water seeping into the foundation.

If standard library is unsound, that means pretty much everything derived from/relying on that functionality is unsound.

Adding unsoundness for the sake of pushing a feature out is just bad. It's cutting corners on essential things.

> they also could have said "ship it"

True. But if I know that BDFL is an asshat, then I avoid that project.

Re:The biggest threat to Rust's sustainability by steveklabnik on Friday March 19, 2021 @11:46AM (#26514692)
There is a difference between saying "I believe new features should have proofs of soundness before landing" and saying that developers are "unprincipled." The former is a specific technical critique, the latter is an insult directed at the people making decisions. Specific technical critiques are great. Suggesting a lack of principle from the developers is not.

Here's why this matters. This response from you is much better! Because:

> If Rust was a house, and a bug was a broken window, unsoundness issue would be water seeping into the foundation.

Yes. Everyone agrees, in principle, that Rust being sound is an important property. Your criticism isn't actually about principles, it (appears to me, anyway) that it is about the specific methods in which we figure out if something is sound or not. You can argue that nothing should be added without formal proof, and that's a fine position to take, but at least it is a specific, actionable criticism that can be discussed directly.

By this standard, virtually all languages have "unprincipled" designers. This isn't even true of only async! We didn't (and still sort of don't) have a formal model of the borrow checker. So you can't really criticize async specifically in this way, you'd have to criticize the entire language.

Re:The biggest threat to Rust's sustainability by Ygg2 on Friday March 19, 2021 @10:19PM (#26520219)
> the latter is an insult directed at the people making decisions

The way I see unprincipled is two fold: 1) You're breaking your promise 2) In a similar situation behave differently

1) Pin was a problem from the start. Allowing it into std/core was a mistake. The fact they allowed an almost blatantly unsound feature is unprincipled.

I'm not 100% sure of the timeline, but near or before the release there were examples floating of a possible Pin unsoundness. And defense was, it's an obscure thing, no one would really use that in practice. The moment designer says, no one would use that in practice, is the moment they lost.

2) Yeah, I get async was a feature everyone wanted. By same measure, why not add self-referential struct. People want it. It's probably unsound but you can't tell. Maybe there exist a model that allows self-referntial structs.

Similar situation, different behavior

Re:The biggest threat to Rust's sustainability by steveklabnik on Saturday March 20, 2021 @03:54PM (#26525667)
Nobody promised full formal specifications before landing features. The pin soundness issue was found close to release, but a plan was made to fix it before it was released. Pin is not fundamentally unsound.

People do want it, and in fact, it is part of async, and directly related to the soundness issues you’re complaint about. The reason such things aren’t in stable is that, while people do want it, people wanted async more, and did the work. The work has to happen, features don’t just magically come into existence.

Re:The biggest threat to Rust's sustainability by ChrisSD on Friday March 19, 2021 @10:14AM (#26513562)
The only unresolved soundness issue for Pin that I can find seems to only affect nightly not stable. https://github.com/rust-lang/rust/issues/68015

It doesn't appear to be unresolvable.

Re:The biggest threat to Rust's sustainability by Ygg2 on Friday March 19, 2021 @11:24AM (#26514384)
I never said they were unresolvable. I'm glad they are resolvable.

But what if the issue was unresolvable? Rust would either have to rollback a feature or basically say, we're sound, except for that part.

Re:The biggest threat to Rust's sustainability by carols10cents on Friday March 19, 2021 @10:26AM (#26513703)
You don't have to use async if you don't want to.
Re:The biggest threat to Rust's sustainability by jcelerier on Friday March 19, 2021 @05:52AM (#26511575)
> If you want to use modern systems, and you're going with C++. Good luck. You're gonna need it.

if you're doing modern stuff you just use a task-based parallelism lib and pass things by value with libs such as https://github.com/taskflow/taskflow, https://github.com/cameron314/concurrentqueue ...

Re:The biggest threat to Rust's sustainability by wealthyyy on Friday March 19, 2021 @05:30PM (#26518310)
Linus wanted attention and C++ was perfect. Later down the road, he even ranted about Java. It's clear he is a hater of OOP and Abstraction in general. Now, Linus Cultists promotes Data Oriented Design.

The attention thing said by Bjarne by himself when asked on Reddit.