News for hackers. Stuff that matters.
Re:I can't keep up with idiomatic Rust by gautamcgoel on Wednesday April 08, 2020 @09:45PM (#22819073)
This a key difference between the Go community and the Rust community. Go is like C 2.0: it tries to be minimal and stable. Go usually ships with no language changes between releases. Rust is like C++ 2.0: it is constantly being revised and expanded, supposedly to improve power, performance, and ergonomics. When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has. What these devs perhaps fail to appreciate is that not having new features can itself be a feature.
Re:I can't keep up with idiomatic Rust by dilap on Wednesday April 08, 2020 @09:52PM (#22819100)
I'm a Go fan and I've used it tons; I'm Rust-curious, but I've only made toy programs w/ it. While there is a germ of truth to this -- C++ and Rust are both complex -- I think it carries w/ it a lot of connotations which are untrue.

To wit, C++ is a brutal, terribly designed mess that's absolute torture to work with.

Rust is extremely well-designed and a pleasure to work with.

Very important difference!

Re:I can't keep up with idiomatic Rust by inimino on Wednesday April 08, 2020 @10:58PM (#22819386)
C++ is two and a half decades older than Rust. Come back to this comment in 25 years and see how well the pleasure of Rust's design has held up.
Re:I can't keep up with idiomatic Rust by thawaway1837 on Thursday April 09, 2020 @12:01AM (#22819657)
That’s ironic because arguably C++ became a much better language in the last decade or so than what it was before that.
Re:I can't keep up with idiomatic Rust by rob74 on Thursday April 09, 2020 @12:33AM (#22819806)
...and I'm sure the language features which feel like torture now looked like a good idea at the time they were implemented, decades ago.
Re:I can't keep up with idiomatic Rust by dwaite on Thursday April 09, 2020 @04:09AM (#22820672)
However, most of those torturous points were from the onset, to attempt 100% compatibility with C.
Re:I can't keep up with idiomatic Rust by marcosdumay on Thursday April 09, 2020 @10:01AM (#22822616)
Hum... No they didn't. People were creating new languages by that time just to reimplement them correctly.
Re:I can't keep up with idiomatic Rust by dralley on Friday April 10, 2020 @05:26PM (#22837523)
The "edition" model is a big point in Rust's favor. They can make "backwards incompatible" syntax changes without infringing on the ability to compile older code.
Re:I can't keep up with idiomatic Rust by aloknnikhil on Wednesday April 08, 2020 @11:25PM (#22819485)
Pre-C++11 was. Modern C++ not so much. Things have drastically improved and dare I say, it's more appropriate to call C++11 and greater C++ v2. That said the tooling around build/test/dependency management/versioning leave much to be desired for. But a combination of meson (for build), Catch (for test) and CMake for dependency management can go a long way.
Re:I can't keep up with idiomatic Rust by baby on Thursday April 09, 2020 @03:52AM (#22820608)
Do you still need to write makefiles manually?
Re:I can't keep up with idiomatic Rust by dwaite on Thursday April 09, 2020 @04:13AM (#22820690)
If you are using makefiles, you either write them manually or use a generator like Cmake or the autotools. Tools or scripts to automate build are required in all languages once you hit a certain level of heterogeneity/complexity.
Re:I can't keep up with idiomatic Rust by umanwizard on Thursday April 09, 2020 @08:41AM (#22821951)
What does the build system have to do with the language?

The current trend of combining the two concerns by having language-specific build systems (like Cargo) was a mistake, IMO.

Re:I can't keep up with idiomatic Rust by Too on Saturday April 11, 2020 @02:21AM (#22839969)
Common grounds and uniformity - if every library were using it's own build system it becomes very hard to combine libraries. See c++ for example, when including a library you always have to either wrap the build, rewrite it to your build system or find a a way to prebuild. And every library is unique. Contrast this with other systems where you just add a line to your package.json file. Big red flag is that people come up with those header-only libraries or single .c-file only libraries, just to get around the problem of package management.

Language rules define dependency rules, that the build system is not aware of. For example transitive #include chains, requiring stuff like gcc -MMD to generate makefiles. This also improves IDE experience with suggestions on where to find imports instead of elementary error messages like "header file not found".

Re:I can't keep up with idiomatic Rust by adrianN on Thursday April 09, 2020 @08:59AM (#22822079)
It has a lot to do with the language because the ease of adding external libraries has an enormous impact on the design choices made when writing code.

Also, the need for header files and disgusting hacks like unity builds just adds unnecessary friction.

Re:I can't keep up with idiomatic Rust by signa11 on Thursday April 09, 2020 @11:23AM (#22823405)
> ... language because the ease of adding external libraries has an enormous impact on the design choices...

even if you could incorporate external libraries with zero impedance mismatch, you still have to _use_ the said libraries.

while there might be _marginal_ element of truth to that statement, however ease of stitching external libraries into your application has no bearing on either the programming language or the act of programming the application itself.

Re:I can't keep up with idiomatic Rust by adrianN on Thursday April 09, 2020 @11:44AM (#22823628)
I don't understand what you're trying to say. Of course the effort to include the library in the project and keep it up to date has an impact on the decision whether I use it or whether I just roll my own. There is a reason that my Rust projects have dozens of dependencies whereas in C++ I basically restrict myself to boost or other header-only libraries.
Re:I can't keep up with idiomatic Rust by signa11 on Friday April 10, 2020 @01:16AM (#22830194)
> I don't understand what you're trying to say.

simple, ease of integrating external libraries into a project has _nothing_ to do with the programming language.

they are at best two orthogonal topics.

Re:I can't keep up with idiomatic Rust by baby on Friday April 10, 2020 @01:53AM (#22830362)
50% of the popularity of modern languages like golang and rust comes from the fact that building and dependency management is light years ahead of older languages.
Re:I can't keep up with idiomatic Rust by signa11 on Friday April 10, 2020 @02:40AM (#22830566)
remind me again on what that has to do with either the syntax or the semantics of the underlying programming language.
Re:I can't keep up with idiomatic Rust by mrpf1ster on Friday April 10, 2020 @02:20PM (#22835842)
Your original argument was that the ease of dependency management doesn't change programming or the act of programming. I feel it encourages a compartmentalized approach to writing programs, pulling in dependencies as needed rather than relying on a giant library like Boost. Thus it does actually change the "act of programming", which is a vague term that can mean anything.

This is not mentioning all the upsides of having a easy build system from easy learning and community standpoints.

Re:I can't keep up with idiomatic Rust by baby on Thursday April 09, 2020 @11:16AM (#22823335)
Ah. So some people like writing makefiles. Interesting.
[dead]
Re:I can't keep up with idiomatic Rust by baby on Thursday April 09, 2020 @03:54AM (#22820612)
Every languages must have generics and overloading? Gosh that’s one crazy opinion.
Re:I can't keep up with idiomatic Rust by adev_ on Thursday April 09, 2020 @05:01AM (#22820882)
That's my opinion for system language. And even if purely superficial, it has already more argument that the previous comment.

But yes, if your language pretend to be a modern system language, you should yes. Not being able to write generic data structure or linear algebra containers in 2020 is a shame yes.

Re:I can't keep up with idiomatic Rust by baby on Thursday April 09, 2020 @11:15AM (#22823329)
Well. I love the fact that Go code doesn’t have generics. Super clear to read. I must be a goof.
Re:I can't keep up with idiomatic Rust by littlestymaar on Thursday April 09, 2020 @04:13AM (#22820692)
We hear this narrative really often even though it's not accurate: Go has its share of outrage about one change (in error handling too amusingly) last year and the proposal (the try keyword) even had to be repealed because it was considered too revolutionary. Go modules are a huge change in how Go dependency management works and it's comparable, or even bigger in scope, to the Rust changes in 2018 edition regarding modules. And in a near future, Go's generics (contracts) are going to be a dramatic change, in a scale Rust arguably hasn't faced yet since 1.0, even though there is some similarities with the impl Trait features.

In fact, Go and Rust are both evolving fast compared to C (and maybe even to C++) and interestingly enough, most of the time the evolution comes in similar domains (error handling, modules, generics).

The big difference is the release schedule: Rust release small changes often while Go release big changes rarely. The 6-weeks schedule has advantages (each version is quite small so it's easier to test and bugs are found earlier) but it adds a feeling of churn which can be harmful.

Re:I can't keep up with idiomatic Rust by ldng on Thursday April 09, 2020 @04:32AM (#22820761)
The point is that Rust is changing too fast. Not that Go does not change ever.
Re:I can't keep up with idiomatic Rust by ChrisSD on Thursday April 09, 2020 @05:04AM (#22820896)
"Too fast" is relative but the Rust language has had few changes since the 2018 edition (and even that can work alongside the 2015 edition). The pace of change has slowed significantly in recent years. The standard library has had more additions (but Go has had changes there too).

The blog post we're all commenting on started because someone took umbrage to an idea someone else expressed in another blog post. Not because of any actual language changes, not even a formally proposed change, just an idea in a blog post. All the actual changes mentioned ("try!() -> ?, the addition of impl trait, and the dyn keyword") happened years ago. And not all at once. It took years from adding `?` to adding `dyn`.

Re:I can't keep up with idiomatic Rust by littlestymaar on Thursday April 09, 2020 @04:56AM (#22820860)
My point is that Rust doesn't really change more than Go does. Rust used to change a lot after 1.0, but for the past 3 years it hasn't been the case if you compare it to how much Go changed.
Re:I can't keep up with idiomatic Rust by Ar-Curunir on Thursday April 09, 2020 @12:19AM (#22819726)
Rust has only become more uniform and contains less special cases than just a couple of years ago.

The rate of adding features is quite slow, as demonstrated elsewhere in this thread. Important features spend a long time baking, and a long time in testing before they are piecewise stabilized.

> When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has.

Of course when someone talks about a CHANGELOG, they'll talk (rather happily) about the things that have changed/improved.

Re:I can't keep up with idiomatic Rust by lmm on Thursday April 09, 2020 @02:28AM (#22820301)
> Rust has only become more uniform and contains less special cases than just a couple of years ago.

How so? Aren't await and ? both new special cases?

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:24AM (#22822800)
They are new features, so in some sense, they're "special cases", but even then, okay, so that's adding two special cases. Rust is still removing special cases all the time.

Take the Rust 1.42 release, for example. Way back in Rust 1.31, we removed the need for you to write `extern crate`. But when you were writing a procedural macro, you still had to write "extern crate proc_macro;". With Rust 1.42, you no longer have to, and it just works, like everything else. This removed a special case.

Rust has been doing a lot of the "this was special cased to ship, now we are making it more general like we always planned" lately.

Re:I can't keep up with idiomatic Rust by kibwen on Thursday April 09, 2020 @09:53AM (#22822538)
What the GP means there is that when the list of new "features" comes out with each Rust release, if we discard the features that are just new stdlib APIs (~75% of the total count for an average release), most of the remaining "features" are just tweaks to existing language features that remove edge cases, e.g. non-lexical lifetimes.

As for your second question, async/await is absolutely the biggest thing added since 1.0 (and is an outlier in new features in that regard); the ? operator is just an improved version of the try! macro that shipped with 1.0.

Re:I can't keep up with idiomatic Rust by lmm on Thursday April 09, 2020 @07:37PM (#22828390)
The way I see it NLL added a huge number of edge cases. Pre-NLL it was clear what kind of lifetimes were possible; now I have no clue what the different lifetimes are and every keyword interacts with lifetimes in a different way.
Re:I can't keep up with idiomatic Rust by mrpf1ster on Friday April 10, 2020 @02:24PM (#22835897)
Pre-NLL made the language incredibly clunky to use, with a lot of code acrobatics required to do something you know should work logically according to ownership but the scope lifetime rules wouldn't allow.
Re:I can't keep up with idiomatic Rust by lmm on Thursday April 16, 2020 @12:06AM (#22885943)
I don't disagree. But IMO a lot of clarity and comprehensibility has been sacrificed in the current implementation. I'd rather have seen a style that de-emphasised control flow keywords and made it easier to use closures, or simply blocks, to express the behaviour that people wanted. I've yet to see a case where what was really needed was NLL rather than better support for lexical lifetimes.
Re:I can't keep up with idiomatic Rust by umanwizard on Thursday April 09, 2020 @08:42AM (#22821960)
I don’t know any other “systems” language whose language definition changes every six weeks. When you say Rust changes slowly, what are you comparing it to?
Re:I can't keep up with idiomatic Rust by rcxdude on Thursday April 09, 2020 @10:08AM (#22822657)
Frequency of change and rate of change are very different. C++ (now) changes at about the same rate but in larger, less frequenct increments.
Re:I can't keep up with idiomatic Rust by Ar-Curunir on Thursday April 09, 2020 @10:42AM (#22822972)
Do you think C and C++ didn’t change in their first five years?
Re:I can't keep up with idiomatic Rust by Skunkleton on Wednesday April 08, 2020 @10:12PM (#22819196)
IMO Go is more like C people took a stab at making a Java. I really like go, and it’s ethos, even if I haven’t used it much in production. Go is not however a replacement for C in the way C++ and Rust can be. Of course Rust and C++ aren't a replacement for C in some key ways, so maybe I don't have a point here?
Re:I can't keep up with idiomatic Rust by typ on Thursday April 09, 2020 @01:40AM (#22820106)
It's been mentioned from time to time that Go is a successor of C. As I recently had a look into the Pascal/Oberon family. It looks that Go is no less influenced by Oberon than C. The CSP paradigm likely comes from Rob Pike's previous works. And the syntactical elements, such as the operators and punctuations, also follow the C tradition. But the overall program structure (including the approach to OOP and probably the 'evolving-by-reduction-rather-than-addition' philosophy) makes it seem closer to the Oberon linage.
Re:I can't keep up with idiomatic Rust by pjmlp on Thursday April 09, 2020 @07:34AM (#22821541)
Active Oberon also had co-routines in the form of active objects.

Also note that 'evolving-by-reduction-rather-than-addition' philosophy is only part of Wirth's Oberon linage.

Oberon-2 (which Go got its method syntax from), Active Oberon, Component Pascal and Zonnon, are all Oberon descendents from ETHZ as well, which go into the direction of mainstream languages, including support for generics or more low level programming capabilities.

Re:I can't keep up with idiomatic Rust by peteretep on Thursday April 09, 2020 @03:51AM (#22820605)
> The CSP paradigm likely comes from Rob Pike's previous works

"The CSP paradigm" comes from CSP: https://en.wikipedia.org/wiki/Communicating_sequential_proce... which predates the vast majority of Rob Pike's work (eg: before he went to Bell Labs).

Re:I can't keep up with idiomatic Rust by yiyus on Thursday April 09, 2020 @06:26AM (#22821217)
Yes, that's the original inspiration. But Rob Pike has been implementing CSP ideas in different languages for a few decades now, and all that work has highly influenced the implementation in Go.
Re:I can't keep up with idiomatic Rust by dgb23 on Thursday April 09, 2020 @06:33AM (#22821234)
Obviously what OP meant is the implementation of it. Rob Pike mentioned Tony Hoare‘s work in almost every talk he gave about Go‘s concurrency.
Re:I can't keep up with idiomatic Rust by SaxonRobber on Thursday April 09, 2020 @12:34AM (#22819810)
C++ has had decades to replace C, but it’s really stalled and even lost ground in embedded systems. I can’t see Rust faring much better. C might end up being an eternal language until there is a dramatic enough shift in operating systems to merit replacing it.
Re:I can't keep up with idiomatic Rust by alexhutcheson on Thursday April 09, 2020 @10:37AM (#22822931)
In my opinion, there are two main factors driving this:

- Lower spec devices have a hard cap on overall code complexity imposed both by available ROM or flash constraints (big projects literally won't fit on the chip), and by time constraints (if your chip is running at <= XX MHz when it's active, you don't have time to run very many functions between events or interrupts). Most projects for these devices won't grow to the point where you really need the code organization benefits that C++ provides.

- It's a lot less effort to port or implement a C toolchain for your chip than it is to port or implement a toolchain for a more complex language like C++, Rust, or even Ada. It's not just the compiler - you also have to have a working standard library (even if some functions are just stubs), an interactive debugger, and integrations with IDEs (if you already provide that for C). All that software engineering is expensive, and you have a much smaller market of developers to amortize that cost over.

These constraints aren't as binding for high-production, higher-spec devices like popular families of ARM Cortex-M chips, so usage of C++ seems to be relatively more popular for those devices. Even then, embedded work normally requires more of a "C with classes" or "C plus the std::algorithm library" approach, which is different from C++ projects you'd see that target servers.

Re:I can't keep up with idiomatic Rust by pjmlp on Thursday April 09, 2020 @07:30AM (#22821528)
Mostly because embedded C isn't ISO C, rather MISRA C, TI C, Microchip C,...
Re:I can't keep up with idiomatic Rust by takeda on Thursday April 09, 2020 @02:16AM (#22820250)
> IMO Go is more like C people took a stab at making a Java.

And in a way it is :) given who worked on it, and where it was created.

Re:I can't keep up with idiomatic Rust by pjmlp on Thursday April 09, 2020 @07:29AM (#22821525)
That was Limbo actually, and the attempt was at Java 1.0 apparently.

Despite my opinion regarding its design, Go was definitely a C replacement for F-Secure TamaGo, Google's gVisor, Android GPGPU and CoreBoot projects.

Re:I can't keep up with idiomatic Rust by tmh88j on Wednesday April 08, 2020 @10:23PM (#22819241)
>IMO Go is more like C people took a stab at making a Java.

I haven't used Go beyond tutorials and some very basic programs, but I am pretty comfortable with Java. What about Go makes you feel it's relatable to Java? From what I've read the lack of generics is a hot topic in the Go community, but they're pretty crucial to most programs written in Java. Is this still true?

Re:I can't keep up with idiomatic Rust by correct_horse on Wednesday April 08, 2020 @10:51PM (#22819352)
As a side note, Java also didn't ship with generics. Java was released in the mid 90s and didn't have generics until about 10 years later with version 5. This timing should feel familiar - Go first appeared ~10 years ago in 2009.

You may remember that in Java 1.4, `get`ting from collections (e.g. ArrayList) always returned Object, which you were expected to cast to their runtime type (or a class that their runtime type inherits from). I was young at the time, correct me if I'm wrong. Contrast this with Go's solution, which seems to be user-inaccessible compiler magic. I much prefer Go's solution to Java's, but I also like generics.

Re:I can't keep up with idiomatic Rust by saagarjha on Wednesday April 08, 2020 @10:53PM (#22819361)
I really hate user-inaccessible compiler magic. Java had its fair share of that, but Go seems to take it even further :(
Re:I can't keep up with idiomatic Rust by Skunkleton on Thursday April 09, 2020 @03:44PM (#22826407)
I think compiler magic is pretty great. Hotspot is a pretty magical compiler. Go is less magical IMO because it is AOT compiled.
Re:I can't keep up with idiomatic Rust by saagarjha on Thursday April 09, 2020 @04:14PM (#22826717)
By compiler magic I really mean syntax reserved to the language itself; for example, Java's String having extra operator superpowers or Go's generics that are only available to a chosen set of standard collections.
Re:I can't keep up with idiomatic Rust by antoinealb on Thursday April 09, 2020 @05:19AM (#22820956)
I think you can do the same in Go, using the empty interface (that can represent any type) and then having the user cast it to the correct type. Unfortunately this is not type safe, and type safe generics in go, such as maps is only available to the compiler.
Re:I can't keep up with idiomatic Rust by doliveira on Wednesday April 08, 2020 @10:32PM (#22819279)
Java didn't have generics before version 5, I think. It was a hell of casting back and forth Object, much like Go and interface{} today.
Re:I can't keep up with idiomatic Rust by Skunkleton on Wednesday April 08, 2020 @11:07PM (#22819418)
The language and tooling is designed for development at scale. Lots of pragmatic trade offs were made. Its not flashy at all, and could even be accused of being a bit boring. It is also appropriate for a similar domain.
Re:I can't keep up with idiomatic Rust by takeda on Thursday April 09, 2020 @02:21AM (#22820267)
yep, there Go was labeled as a replacement for C or Python, and while it in no way replaces C and and as for Python it generally only does when the Python wasn't the right choice from the start.

In reality Go can fully take over Java's problem space.

Re:I can't keep up with idiomatic Rust by qqssccfftt on Thursday April 09, 2020 @05:08AM (#22820913)
> In reality Go can fully take over Java's problem space.

Or, when Project Loom releases, Java will be able to fully take over Go's problem space.

Re:I can't keep up with idiomatic Rust by takeda on Thursday April 09, 2020 @03:39PM (#22826364)
Sorry, my previous post sounded like I was picking a favorite, what I meant is that Go and Java pretty much has identical problem space.
Re:I can't keep up with idiomatic Rust by pjmlp on Thursday April 09, 2020 @07:36AM (#22821551)
Not really, unless it provides generics, JEE and Spring like frameworks, supports all embedded CPUs, Oracle/SQL Server/DB2, mainframes, has an OS of its own, a GUI half as good as Swing,....
Re:I can't keep up with idiomatic Rust by kelnos on Thursday April 09, 2020 @07:30PM (#22828336)
Not without generics it can't. I know a lot of people seem to think that generics aren't necessary in Go, but I vehemently disagree with them.
Re:I can't keep up with idiomatic Rust by krakatau1 on Thursday April 09, 2020 @10:00AM (#22822604)
there is no way that's happening, outside of silicon valley practically no one is using Go, there are millions Java developers who are quite content with language...
Re:I can't keep up with idiomatic Rust by 7thaccount on Wednesday April 08, 2020 @10:29PM (#22819262)
Garbage Collector?
Re:I can't keep up with idiomatic Rust by EdwardDiego on Thursday April 09, 2020 @05:17AM (#22820946)
Go's GC is quite different to Java's though - deliberately not as many knobs to twiddle.
Re:I can't keep up with idiomatic Rust by phkahler on Wednesday April 08, 2020 @10:44PM (#22819327)
Stability is THE most important feature. Rust needs to mature a little more and then mostly just stop. I seriously hope that it doesnt follow the C++ path.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @12:01AM (#22819661)
Rust has made very strong stability guarantees.

Just today someone posted in /r/rust about how they took a two year old project, compiled it with the latest compiler, no issues. Other than it magically took less time to compile and the end result ran faster.

Re:I can't keep up with idiomatic Rust by jgon on Thursday April 09, 2020 @01:12AM (#22819972)
This is a pretty complete misunderstanding of what the previous commenter was saying. You can probably find 20+ year old C++ code that will compile just fine with the latest compiler and it will take less time to compile and the end result will run faster. But that's not what people are complaining about when they talk about C++'s ever growing scope and the insanity of trying to cope with the 1001 ways of doing something in the language.

I have it straight from the horse's (Bjarne's) mouth that there will be no more editions of "The C++ Programming Language" because the language is too big and writing a book too time consuming to actually cover the language as it currently exists and what it is going to become. It's own creator admits that the language is too big to document in book form. How does one ever expect a beginner to get to grips with it in that case!?!

Obviously Rust isn't there as it doesn't have 30 years of evolution and development like C++ does. But the rate at which it is growing and changing means it won't actually take 30 years to become the new C++. And that would be a real tragedy. What's the use of all these awesome safety features if they're in a language almost no one will be able to fully comprehend or understand?

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @01:21AM (#22820025)
The parent made two claims, I only responded to one of them. You seem to think I responded to the other one. I'm sorry for not being more clear about that!

> But the rate at which it is growing and changing means it won't actually take 30 years to become the new C++.

I very, truly, seriously doubt this is true. First of all, as I said elsewhere in the thread, Rust has been changing very slowly lately. But beyond that, a significant reason for C++'s complexity is that it's sort of two, possibly three different languages: Modern C++ is very different than C with Classes. It is a miracle that they retrofitted a new language on top of an old one, but there's no indication that Rust will ever do that. The quantity of change is one thing, but the qualitative aspects matter here too, and I feel like you're only considering the quantitative aspect (which, I also disagree with, to be clear.)

Re:I can't keep up with idiomatic Rust by DeathArrow on Thursday April 09, 2020 @01:33AM (#22820084)
Why do you have to fully understand a very complex system to work with it? Isn't it enough to understand a part that enables you to do your job?
Re:I can't keep up with idiomatic Rust by baq on Thursday April 09, 2020 @09:04AM (#22822115)
20 year old C++ has absolutely no chance to compile with a modern compiler unless it has a compatibility option for 20 year old C++ and you know how to enable it. i've had to fix 2 year old code when upgrading gcc.
Re:I can't keep up with idiomatic Rust by UncleMeat on Thursday April 09, 2020 @10:34AM (#22822905)
What breaking changes have gone in since 2000 that didn’t break a change added after 2000?

Auto is the only one I can think of.

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:44AM (#22822993)
When were trigraphs added?

(I am just curious, I have no idea how common your parent's comment is in real life.)

Re:I can't keep up with idiomatic Rust by kelnos on Friday April 10, 2020 @01:03AM (#22830131)
Pretty sure gcc doesn't enable trigraphs unless you pass a command-line option to do so (and maybe it's included in -std or -ansi or something like that).
Re:I can't keep up with idiomatic Rust by baq on Thursday April 09, 2020 @05:02PM (#22827164)
i've had issues with templates, but please forgive me if i don't provide specifics because it was ages ago. i've stopped doing C++ long before auto was even proposed so can't comment on that.
Re:I can't keep up with idiomatic Rust by Fordec on Thursday April 09, 2020 @01:06AM (#22819938)
Two years is nothing, absolutely nothing, in the grand scheme of "long term".
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @01:14AM (#22819986)
That's correct. Rust is still a pretty young language; it's only been stable for five years. This doesn't mean that two years is meaningful in a broader sense, that is, this is one random anecdote. I know of a crate that still maintains Rust 1.13 compatibility, and that's about three and a half years. Still not actual evidence, of course.

Code that doesn't rely on soundness bugs written in 1.0 should generally compile on the latest stable release without issue. The vast majority Rust users in our annual survey report that their code never breaks, and of those that have, the majority have said that it is trivial or easy to fix.

We put a tremendous amount of work (and spend a lot of money!) into ensuring this. If upgrading your Rust compiler is a significant issue for you our anyone else, please report these things to us.

Re:I can't keep up with idiomatic Rust by Fordec on Thursday April 09, 2020 @11:57PM (#22829856)
It is indeed a young language.

Upgrading my compiler isn't an issue. I haven't opted to transitioning to Rust at all in the first place until things calm down. I've yet to feel that my career has once ever been impacted by not learning it.

I'm in hardware land, not JavaScript frontends. Innovation there is more about the product features, sensor capabilities, power consumption. Generally solving customer issues.

Selling adoption of a new language to the superiors or new job interviewers to use in production isn't an issue about compiler upgrades or the merits of using cargo fix. They are more concerned about how many people are available to be hired that has extensive expertise in the language, making hiring hard, and support is still in flux. And that is what I'm reporting, tooling is more than about the compiler, the world around it and human issues, particularly non-technical humans are also at hand.

And until there is stability and a language people don't feel is a moving target to learn, that will remain the chicken and egg scenario.

Re:I can't keep up with idiomatic Rust by steveklabnik on Friday April 10, 2020 @12:11AM (#22829906)
We’ll just see :)
Re:I can't keep up with idiomatic Rust by WilliamEdward on Thursday April 09, 2020 @02:21AM (#22820268)
Actually it's approximately 20% of rust's total time on earth. That's very long, relatively speaking.
Re:I can't keep up with idiomatic Rust by yahyaheee on Wednesday April 08, 2020 @10:08PM (#22819172)
Yea I think this concept just doesn’t resonate deeply with the rust community for some reason
Re:I can't keep up with idiomatic Rust by dodobirdlord on Wednesday April 08, 2020 @10:23PM (#22819244)
> When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has. What these devs perhaps fail to appreciate is that not having new features can itself be a feature.

Rust is trying to solve a set of problems, some combination of which exist in pretty much every programming language that exists today (including Rust). "Have you considered giving up?" is obviously not a very interesting question and not one that's going to get much traction.

Re:I can't keep up with idiomatic Rust by ddevault on Wednesday April 08, 2020 @10:37PM (#22819301)
The question is not "have you considered giving up?", but rather "have you considered when this will be finished?"
Re:I can't keep up with idiomatic Rust by ironmagma on Wednesday April 08, 2020 @10:44PM (#22819326)
From using Rust, it’s clear there is still a lot of work to be done. Someday Rust will be stable and mature, but it isn’t now, and it doesn’t look like it will be a year from now either. The plasticity of the language honestly is what allows it to continue to innovate where others do not. Let’s let Rust find its niche and then lock it down, and not rush it or we’ll be regretting it in a few years.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @12:18AM (#22819724)
The only languages that are “finished” are the ones nobody uses. Heck, C’s latest standard is from 2018. And there’s probably gonna be a new one next year. Most changes are minor, but sometimes they’re bigger. Just like any language. It moves much slower than most languages, but it’s still moving.
Re:I can't keep up with idiomatic Rust by ddevault on Thursday April 09, 2020 @08:56AM (#22822056)
C's 2018 standard cannot be compared to Rust's development in good faith. C didn't add anything new - it just clarifies edge cases, and does not change downstream C code in meaningful ways. And that constitutes 7 years of C development.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:26AM (#22822820)
C 2018 was a small release, sure. There are bigger ones. C11 added an entire memory model.

> it just clarifies edge cases, and does not change downstream C code in meaningful ways.

This is exactly the same as Rust. (Again, with the small exception of soundness fixes, which, depending on impact, we sometimes leave a year of warnings in before actually changing.)

Re:I can't keep up with idiomatic Rust by ddevault on Thursday April 09, 2020 @10:29AM (#22822857)
Yes, there have been bigger C standards updates. But keep in mind: these happen maybe once per decade.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:36AM (#22822918)
Sure. This is moving the goalposts though: you initially said "when will this be finished?" It is clear that C is not finished.
Re:I can't keep up with idiomatic Rust by ddevault on Thursday April 09, 2020 @10:43AM (#22822983)
I would strongly disagree with that. C is finished, and what they've been working on for the past decade doesn't change that. I don't think you're arguing in good faith if you claim that the C development lifecycle is even remotely comparible to the Rust development lifecycle, and I'm not going to continue entertaining this.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:50AM (#22823068)
I don't think that you're arguing in good faith when you claim that Rust putting out new versions means "it's not done" but C putting out new versions means "it is done."

My argument is not that they are comparable. My argument is that it's a difference of degree, not of kind.

Re:I can't keep up with idiomatic Rust by ddevault on Thursday April 09, 2020 @11:03AM (#22823207)
The difference is obviously in what kind of changes are included in each "release". C has a specification (something Rust lacks) and C18 simply clarified unclear edge cases in the standard. No new features were added. Rust releases add new features and semantics, Q.E.D.
Re:I can't keep up with idiomatic Rust by AndrewGaspar on Thursday April 09, 2020 @10:17AM (#22822737)
New Rust versions don't change downstream Rust code either, except in edge cases. And those edge cases are only to fix potential security vulnerabilities.
Re:I can't keep up with idiomatic Rust by ddevault on Thursday April 09, 2020 @10:29AM (#22822846)
Changing the definition of idiomatic counts as changing downstream code.
Re:I can't keep up with idiomatic Rust by kelnos on Friday April 10, 2020 @01:08AM (#22830162)
Only if you feel like you need to constantly update your code to be idiomatic, which is absolutely unnecessary. No one has to change their code to conform to whatever the new version of "idiomatic" is. Their code will continue to work, and it won't be "bad".
Re:I can't keep up with idiomatic Rust by DeathArrow on Thursday April 09, 2020 @01:36AM (#22820091)
Try Cobol, it's pretty much finished.
Re:I can't keep up with idiomatic Rust by moogly on Thursday April 09, 2020 @12:45PM (#22824432)
The latest version was released in 2014
Re:I can't keep up with idiomatic Rust by frankmcsherry on Thursday April 09, 2020 @09:04AM (#22822108)
I don't think it's about giving up, but accepting that churn has costs.

Of the first 15 or so Rust releases, 4 of them caused library code I maintain (timely dataflow) to publicly break. They were all minor "paper cut" breaks that one could fix by changing the syntax, but several were in the public APIs (most were around convenience features, clashing in namespaces). The stated position of the Rust team was that it is ok to break code in this way.

I brought this up with some of the team; I do think they are more aware of it now; many are still more excited to land new things than preserve the experience of the users (I'm ok with that, but it is what it is).

Re:I can't keep up with idiomatic Rust by lmm on Thursday April 09, 2020 @02:33AM (#22820322)
> Rust is trying to solve a set of problems, some combination of which exist in pretty much every programming language that exists today (including Rust).

There's a well-known feature in similar languages that would solve at least two of the mentioned cases in one go: https://philipnilsson.github.io/Badness10k/escaping-hell-wit...

Re:I can't keep up with idiomatic Rust by dodobirdlord on Thursday April 09, 2020 @04:00AM (#22820636)
Hopefully someday, but nothing is free until someone comes up with a zero-cost abstraction, and in the meantime Haskell relies on a garbage collector.

Thank you for the link, I enjoyed it a great deal!

Re:I can't keep up with idiomatic Rust by lmm on Thursday April 09, 2020 @04:39AM (#22820795)
There's no reason monad shouldn't be a zero-cost abstraction, to the same extent as any other trait (i.e. using them in cases where the type is not statically known would require boxing, but the abstraction is not really a cost overhead in that case since you simply couldn't write that code at all without it).

Haskell currently uses a garbage collector, as do most languages that we could look to for inspiration, but I don't see that that's an essential barrier. The part I would be worried about doing in the presence of a borrow checker would be being able to form first-class functions, especially closures, but Rust already has those! AFAICS the only other "hard" part is having higher-kinded types and preserving good type inference, but the solution to that is already known (Hindley-Milner).

Re:I can't keep up with idiomatic Rust by marcosdumay on Thursday April 09, 2020 @10:14AM (#22822710)
I didn't look deep enough to be confident, but I don't understand Rust's issue with do notation.

It already has monads, and uses them in a lot of places. Do notation is just syntax sugar.

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:28AM (#22822836)
Here's one simple part of this very large and thorny problem: each of Rust's monad instances does not share the same type signature, even for similar methods. This is because Rust has more novel features that appear in type signatures.
Re:I can't keep up with idiomatic Rust by lmm on Thursday April 09, 2020 @07:55PM (#22828492)
To reduce the problem to a simpler (but useful) one: what would it take to be able to write a generic "compose" function (on function values) that would be polymorphic across at least Fn/FnMut/FnOnce? This is something that people already write the specific versions of; obviously the general version requires some form of HKT, but it's not clear (at least to me) what's blocking that.

When I've seen discussions of HKT in Rust it feels like there's an awkward circularity where if you talk about HKT people say the use cases aren't there, but if you talk about things that need HKT people say they can't be implemented because they need HKT. And I'm worried that the conversation about extending the type system has reached a place where adding ad-hoc special cases is seen as the "cautious" approach, when the result is a funny subset of a more general system that's both more complex and less powerful than biting the bullet and implementing the general system.

Re:I can't keep up with idiomatic Rust by steveklabnik on Friday April 10, 2020 @11:16AM (#22833857)
I am not an expert in this area, but the problem is that these things all have very different kinds of permissions, in a sense... I'm not sure what being polymorphic over ownership looks like.

I don't think that anyone who understands this stuff deeply denies that there's good use cases for HKT. There's just not a design, and we're not sure that one actually exists. And a general perception that GATs will give us most of the big benefits of HKT in a way that feels more Rust-like. That being said, there have been a few attempts at this. We'll see.

Re:I can't keep up with idiomatic Rust by lmm on Sunday April 12, 2020 @09:54AM (#22848256)
Being polymorphic over ownership is the most important problem Rust should be looking to solve, IMO: it would make a lot of other problems trivial. I don't necessarily think it's easy, but I do think it's tractable.

The choice to focus on GATs is exactly what I was thinking of. I think Rust will come to regret it, as it comes with most of the costs of full HKT but leads one into working with a limited subset that's not so theoretically well-founded, and I'm not convinced the forward-compatibility is as good as claimed (the semantics may extend to full HKT, but it pushes syntax in a direction that seems likely to make for a frustrating syntax for full HKT). I hope it ends up working out.

Re:I can't keep up with idiomatic Rust by steveklabnik on Sunday April 12, 2020 @12:04PM (#22849090)
How are GATs any less theoretically well founded than HKT?

I can see how maybe working toward that would be a priority in a PLT research sense, but Rust isn't that kind of language anymore. (This is my own opinion and I'm not on the lang team, mind you.)

Re:I can't keep up with idiomatic Rust by lmm on Monday April 13, 2020 @06:15AM (#22854500)
> How are GATs any less theoretically well founded than HKT?

I'm not aware of their having been studied to the same extent, so I don't have the same level of confidence that they are well-behaved. For example, is there a known algorithm for doing perfect type inference in the presence of GAT? What about when we add in subtyping, or higher-rank types? Maybe it's all going to be fine, but the further you stray from the path that's been trodden by PLT research, the more I'd worry about falling down a hole.

Re:I can't keep up with idiomatic Rust by steveklabnik on Monday April 13, 2020 @09:24AM (#22855604)
Gotcha. My understanding was that they were, but not my area of expertise.
Re:I can't keep up with idiomatic Rust by Ar-Curunir on Thursday April 09, 2020 @12:19AM (#22819731)
What concept? Stagnation?
Re:I can't keep up with idiomatic Rust by SaxonRobber on Thursday April 09, 2020 @12:39AM (#22819827)
At what point is enough enough?
Re:I can't keep up with idiomatic Rust by inimino on Thursday April 09, 2020 @02:37AM (#22820337)
Self-selection? There are already many other programming languages that appeal more to those who value elegance or minimalism, so those using Rust either lack the organ that senses elegance, or simply picked Rust anyway because of some other reasons.
Re:I can't keep up with idiomatic Rust by throw_m239339 on Thursday April 09, 2020 @06:38AM (#22821263)
Go is more like static Python rather than C 2.0. I wish Go was C 2.0, but it isn't with its crazy reflection where one can do basically whatever they want, and garbage collector.

Rust is … just Rust.

Re:I can't keep up with idiomatic Rust by graynk on Thursday April 09, 2020 @07:02AM (#22821379)
Static Python is Nim. Go is way more C-like with its structs and pointers
Re:I can't keep up with idiomatic Rust by umanwizard on Thursday April 09, 2020 @08:45AM (#22821974)
Rust is OCaml disguised as c++ :)
Re:I can't keep up with idiomatic Rust by banachtarski on Thursday April 09, 2020 @01:28AM (#22820059)
How is Go anything like a C 2.0. It's more of a server-side scripting language if anything
Re:I can't keep up with idiomatic Rust by pjmlp on Thursday April 09, 2020 @07:40AM (#22821575)
When companies like F-Secure use it to write bare metal security firmware, CoreBoot uses it for UEFI firmware, or Google creates an hypervisor, TCP/IP stack and GPGPU debugger with it.
Re:I can't keep up with idiomatic Rust by umanwizard on Thursday April 09, 2020 @08:39AM (#22821942)
C++ only changes every 3 years. It’s hardly comparable to Rust’s every-six-weeks churn.
Re:I can't keep up with idiomatic Rust by adamnemecek on Wednesday April 08, 2020 @09:49PM (#22819090)
No, it's nothing like C++. The only recent big change was async but how many other things have changed?
Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @12:52AM (#22819882)
The linked article is literally a list of things that are changing too rapidly in Rust to keep up with. Maybe those don't qualify as "big" changes, but then most of C++'s evolution was an aggregation of features that were in isolation fairly small and focused.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @01:03AM (#22819920)
The changes:

* .await. This feature was in development for almost five years. Landed November 2019. This is a legit new feature, with significant ramifications on the language.

* try!() -> ? . This feature was in development for two years, and landed in November 2016. This largely consists of the transformation "try!(x)" to "x?".

* impl trait: this feature was in development for two years, and landed in May of 2018. This has two major parts: one that is very rarely used that is mostly sugar, and another that's pretty useful, and is a legit new feature.

* dyn: this feature was in development for two years, and landed in June of 2018. This is largely optionally adding `dyn` in some places. You don't have to do this. You can turn a lint on that will tell you exactly where to do this, and it can be automatically added to your code.

So that's four features. One of them three years ago, two two years ago, and one last year.

Re:I can't keep up with idiomatic Rust by DeathArrow on Thursday April 09, 2020 @01:41AM (#22820115)
That's awful hard. People have to learn an entire new feature each year? :D

I don't get why people complain. C# is pumping features at a much higher rate and most people are glad. Those features do solve some issues or make it easier to solve them. If you don't have an use case for them, then you don't need to learn them.

Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @11:03AM (#22823205)
Sure, but if you list out C++'s warts, you'll find a much longer list spread out over 30 years. The same effect holds, no?
Re:I can't keep up with idiomatic Rust by estebank on Thursday April 09, 2020 @12:55PM (#22824562)
Not necessarily. The way that new features fit together with existing features has a big impact on how useful and beneficial adding those features are.

In C++, using modern style is .a nicer experience, but at the cost of having to stay away from any code pre-C++11. This is not because C++ designers are bad, but rather because they have more cruft due to existing for longer. Time will tell if Rust will go down that same road, but right now new features fit with the rest of the language and are usually extensions to things that already exist but that weren't allowed in places.

Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @06:06PM (#22827702)
But... again... the contention of the linked article, and one I share, is that these new features don't "fit with the rest of the language" and keeping up with them represents needless cognitive churn.

I mean, sure, that's an opinion thing, and obviously you don't share it. But to me, watching from outside the core rust community, it sure seems like exactly the same thing that happened to C++.

Re:I can't keep up with idiomatic Rust by dralley on Friday April 10, 2020 @11:07PM (#22839380)
It really, really, really needs to be stated that the thing that triggered this whole discussion is not a "new feature", it is not even an RFC, it is a blog post written by a prolific Rust developer who also turned the idea into a library, and wanted to share the merits of the idea.

The fact that it's controversial and "doesn't fit with the rest of the language" means it will very likely never become an RFC in its current state, much less become part of the language.

There is no need for the author to make constant changes to his code. It will continue compiling just fine. Moreover, new "editions" come along with nice documentation on what changed and tooling to automatically fixup code, and are totally opt-in. You can simply wait for a new edition to come along to update your code -- or not, it doesn't ultimately matter that much.

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @12:26PM (#22824135)
I mostly wrote C++98, or at least, C++ of that vintage, so I can't really speak to how hard it is to keep up with later C++ standards. Just providing more context for those specific list of changes, and their frequency.
Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Wednesday April 08, 2020 @09:56PM (#22819112)
Almost the entire language since its early days. And there have been 2 major editions in the last 5 years.
Re:I can't keep up with idiomatic Rust by gamegoblin on Wednesday April 08, 2020 @10:05PM (#22819151)
I don't think it's really fair to talk about pre-1.0 language changes -- by definition, being pre-1.0 typically implies a lack of stability. One of the major editions you mention is the 1.0 release.

So, there has been 1 new edition since 1.0, and, as the parent comment says, the only really groundbreaking change since 1.0 is the stabilization of async support.

Other changes, such as the `dyn` keyword and match ergonomics are mostly superficial, and things such as NLL and additional lifetime elisions are just simple quality of life improvements that don't fundamentally change the language.

Re:I can't keep up with idiomatic Rust by geofft on Thursday April 09, 2020 @12:52AM (#22819879)
Not only is it unfair, it's counterproductive - the lesson future languages will learn is to not work in public and to not improve. Rust pre-1.0 was a mess and nobody would have been better off if it had gotten frozen with all the not-so-great stuff officially supported.
Re:I can't keep up with idiomatic Rust by ekidd on Wednesday April 08, 2020 @10:12PM (#22819190)
I've been writing Rust since before 1.0, and I maintain at least once piece of 5-year-old production Rust code.

In general, old Rust code continues to work almost completely unchanged. There have been 3 or 4 cases where I couldn't compile an ancient dependency because it was relying on something weird like a soundness bug. The fix was usually to update the dependency to the latest minor revision.

Rust 2018 fixed a few minor syntactic issues, adding the "crate" keyword for imports from the current crate, and "dyn" in front of dynamically dispatched traits. These can both be updated using 'cargo fix' in about 20 minutes. Rust 2018 modules can use Rust 2015 modules almost completely seemlessly, even when macros are involved.

Is it perfect? No. But updating older code is something I spend a day or two a year on.

Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Thursday April 09, 2020 @04:25AM (#22820731)
That is fine, but note that 2 days a year is about 1% of work time, and that time increases as the code size increases.

Moreover, in some companies you cannot simply update external dependencies without extra painful reviews.

Re:I can't keep up with idiomatic Rust by kccqzy on Wednesday April 08, 2020 @10:27PM (#22819254)
If by "its early days" you want to talk about pre-1.0 Rust, then I think a fair comparison is pre-C++98 C++, from the original Cfront. At that time C++ was just C with classes. It didn't have templates, namespaces, and plenty of other indispensable features in modern C++.
Re:I can't keep up with idiomatic Rust by artursapek on Wednesday April 08, 2020 @11:02PM (#22819396)
Bryan Cantrill's talk about Rust addresses when they removed green threads, and how much of a bold, disruptive change that was. He remarks on how that impressed him with the Rust community and made him follow the language more closely - had they been too scared to change the language in drastic ways, we would still be stuck with green threads.

Sorry, I can't remember the timestamp right now but the entire thing is worth a listen:

https://www.youtube.com/watch?v=LjFM8vw3pbU

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:29AM (#22822847)
And to be clear, this was before 1.0; we cannot do this kind of thing these days.
Re:I can't keep up with idiomatic Rust by iknowstuff on Wednesday April 08, 2020 @10:07PM (#22819167)
You mean pre-1.0. There has been one major edition afterwards, Rust 2018, which is optional but has awesome new features like non-lexical lifetimes, async/await keywords and I guess `dyn`.
Re:I can't keep up with idiomatic Rust by bschwindHN on Wednesday April 08, 2020 @10:04PM (#22819148)
I would only count language changes since its 1.0 release, there really haven't been that many.
Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Thursday April 09, 2020 @04:08AM (#22820665)
That's fair, then 1 major edition. There have been a lot of added features, though.

I am not sure why people downvoted me.

Re:I can't keep up with idiomatic Rust by kibwen on Thursday April 09, 2020 @10:04AM (#22822632)
In the parlance of the Rust developers, a "feature" is often just the addition of a single function to the standard library. The only remotely paradigm-shifting feature to be added since 1.0 was async/await; the other things mentioned in the blog post are minor QOL nice-to-haves.