News for hackers. Stuff that matters.
Re:Changing the Rules of Rust by Ygg2 on Sunday September 17, 2023 @11:08AM (#37545817)
I think eventually or at some point there might be a need for Rust 2.0 even if it won't be called Rust. Think something like JavaScript and TypeScript. A language that's a super set except the former would be soft deprecated.

I know this is highly unpopular opinion, but I don't consider permanent backwards compatibility a good thing.

Re:Changing the Rules of Rust by vimpunk on Sunday September 17, 2023 @11:12AM (#37545879)
What parts of Rust would you like changed, though?

I think the current version, with its minor warts, is a very pleasant and consistent experience for the most part -- very much unlike C++. So I'm not sure what I'd change to such a drastic degree that it'd require such breaking changes.

Re:Changing the Rules of Rust by lawn on Sunday September 17, 2023 @11:42AM (#37546271)
async still feels half-baked and not pleasant like the rest of the language.

Now, it may be something that still can be fixed and improved upon, but a Rust 2.0 with nicer async experience would be a big win.

Re:Changing the Rules of Rust by Taek on Sunday September 17, 2023 @12:01PM (#37546476)
I would definitely want to see async totally overhauled. Also it would be great if major components of the standard library were all version 1.

And if I want to risk going too far, I'd also advocate for refactoring the type system to be slightly less generic in favor of chasing faster compile times.

Also, ideally the lead designer of SafeLang2.0 would be much more heavy on engineering experience than PL theory. Rust made a lot of tradeoffs that were beautiful in PL theory but are annoying to use on a day to day basis.

I honestly think rust is equal parts amazing ideas and mediocre ideas, and I think a slighky less ambitious language would still be almost as safe (world class compared to any other language) but 10x more fun to use.

Re:Changing the Rules of Rust by gmnash on Sunday September 17, 2023 @01:19PM (#37547336)
A complete overhaul of async sounds nice in the abstract, but without exact details it’s difficult to see how it would be better than what exists.

Similarly, I’m curious as to what the details of a “slightly less generic” type system entails.

Re:Changing the Rules of Rust by thayne on Sunday September 17, 2023 @03:53PM (#37548718)
Besides the Move and Leak traits mentioned in this article, there are several changes I would make to the standard library if backwards compatibility wasn't a concern, including:

Changing Iterator to make use of Generic Associated Types.

Change std::env::set_var to be unsafe. Because using it in multithreaded program causes undefined behavior for any c code that reads the environment (which includes quite a few libc and posix functions).

Change channels to have a better API that is mpmc and closer to crossbeam.

And probably others I can't think of at the moment.

Re:Changing the Rules of Rust by afdbcreid on Monday September 18, 2023 @11:14AM (#37557295)
I'm curious about the "change channels to be mpmc" one. Why isn't it backwards-compatible?

About `std::env::set_var()`, there was a proposal for a `#[deprecated_safe]` attribute that triggers a warning if the function is used without an unsafe block, and eventually make that a hard error in future edition.

Re:Changing the Rules of Rust by ysavir on Sunday September 17, 2023 @11:58AM (#37546449)
I generally agree with you there. Permanent backwards compatibility has strong early rewards and strong late punishments.

I'd love to see programming languages and frameworks add a "gamma" phase to their initial releases. Alphas can be for the internal development, betas can be for stuff that's being tested for bugs and functionality on a public level, and gamma can be a state of "the code can be used out in production, but the API and functionality may change in the future once we see how the tool is used and can identify and resolve operational bottlenecks". Just a handy state that says "feel free to use this, but keep in mind that the interface will likely change for the better but in a non-backwards compatible way based on your experiences using it".

I'm pretty sick and tired of almost every project needing a version 2 because version 1 was essentially publicly released proof of concept that didn't know better.

Re:Changing the Rules of Rust by ferfumarma on Sunday September 17, 2023 @12:05PM (#37546522)
I agree, and would go even further: that all major versions of languages should be renamed.

Like pearl and parrot, as I understand it.

It completely avoids the chance that "python" will become ambiguous regarding which set of rules it refers to: version 2 or version 3.

And the downside is minimal, because anyone can find the most current name online.

Re:Changing the Rules of Rust by twic on Sunday September 17, 2023 @01:16PM (#37547308)
I'm not sure if it is an unpopular opinion; i'm not sure it's an opinion at all, since it seems like a statement of fact - no programming language lives forever, eventually being superseded by newer languages designed with the benefit of lessons learned with the older one.

Except Fortran, Fortran is forever.

Re:Changing the Rules of Rust by Ygg2 on Sunday September 17, 2023 @05:28PM (#37549531)
And Ada, Ada was created perfect.
Re:Changing the Rules of Rust by Guvante on Sunday September 17, 2023 @01:18PM (#37547320)
We still don't have C++ 2.0

And if anybody brings up breaking changes in C++ I will point to how after any of those it sometimes takes almost a decade for everyone to update.

And that was for breaking changes designed to have minimal impact. See how Python 2 is still used in many places 15 years later for what happens if you change how strings work for example.

Re:Changing the Rules of Rust by tialaramex on Sunday September 17, 2023 @03:26PM (#37548483)
WG21 ships a completely new language - very similar to but technically unrelated to the previous one - every three years. C++ 11, C++ 14, C++ 17, C++ 20, and (later this year presumably) C++ 23. It is fascinating that people consider the resulting arbitrary source code breaks to be complete compatibility and yet Rust's choice to offer ongoing compatibility to Rust 2015 edition (Rust 1.0) is somehow not enough...

C++ already changed the definition of std::string, that's why your Linux distro went through painful C++ ABI changes many years ago. They went from one terrible string design to a different terrible string design, ruling out some optimisations GNU can chosen, but mandating optimisations other groups had chosen.

Don't worry though, they didn't standardize an actual string slice type (Rust's &str) until much later, as std::string_view in C++ 17, so most software which didn't actually care about string allocation needed to be thrashed around anyway because there was no vocabulary type for this most obvious thing aside from the hopeless C-style "nul terminated char *".

It's actually hard to over-estimate how terrible they are at this (language standardization). Is it really just that there are too many of them? I find it hard to imagine that just large numbers of people can explain it, plenty of people co-operate to create Rust and the results aren't anywhere close to as awful. Maybe it's the ISO process? I have never participated in ISO standardization of something this complicated, maybe the process is somehow poisonous.

But I think the best explanation is the culture. C++ has developed a culture which prizes arcane nonsense.

Re:Changing the Rules of Rust by Conscat on Sunday September 17, 2023 @04:36PM (#37549053)
> ruling out some optimisations GNU can chosen

GNU didn't do any optimizations that are acceptable in a language with move semantics. The new std::string is _strictly_ better than the old one. Although there do exist very many superior string containers outside of the standard library.

Re:Changing the Rules of Rust by kukkamario on Sunday September 17, 2023 @04:53PM (#37549197)
Large part of why standard was changed so that GCC's copy-on-write strings became non-standard compliant was because CoW made std::string_view and such extremely hazardous. CoW has its benefits but also huge downsides, and small-string optimisation makes lot more sense with the C++11 move semantics.
Re:Changing the Rules of Rust by tialaramex on Sunday September 17, 2023 @07:41PM (#37550496)
For many people SSO would be a waste of time except you need to store the empty string.

There are people who make a lot of very short strings and need them to go fast, but not so many to justify making that a core language feature, if not for the fact that C++ empty string needs a zero byte for C compatibility.

That's why Rust got away without it, their empty string has length zero.

Re:Changing the Rules of Rust by Guvante on Sunday September 17, 2023 @06:07PM (#37549790)
C++ isn't a language that anyone uses.

Everyone uses GCC C++ or MSVC C++ or Clang C++.

This includes the committee that makes the standard and requires a working battle tested implementation before inclusion.

So you get a Frankenstein result because that is the input.

And while yes in theory the standards define a kind of C++ that works on every compiler but the reality is most compilers don't fully support that for literal years best case.

So everyone uses what is available and writes abstractions to handle the harsh edges if they support multiple compilers.

Re:Changing the Rules of Rust by tialaramex on Sunday September 17, 2023 @07:36PM (#37550452)
> This includes the committee that makes the standard and requires a working battle tested implementation before inclusion.

This "requirement" is a mirage, as you can tell by simply installing any of the three compilers from say the week C++ 20 was published and trying to use the headline "modules" feature described in the standard. There are no working implementations.

If you've worked at a large dysfunctional organisation you'll recognise the pattern. Nobody wants to say "No" and make a decision themselves which may go badly - so instead they look for excuses and you're listing one of the excuses. But when they want to do it none of the excuses apply.