Earlier quoted context omitted.
> Rust ending up as a replacement C++ helped it If anything, it's more a C replacement than a C++ replacement. It will take some market share from both of course (and other languages to a lesser extent too), but functionality-wise, it just isn't (currently, at least) practically able to replace some C++ use cases.
I'm interested in more on this. What can I do in C++ that I can't do in Rust?
The Rust I wanted had no future
301–310 of 523 posts
Re: The Rust I wanted had no future
#302Earlier quoted context omitted.
Are you aware of generic associated types , which landed in 1.65 (late last year)? To a considerable extent, they’re Rust’s answer to higher-kinded types. Less expressive in some ways, but fitting Rust way better, as basically a relaxation of a former restriction, rather than a new feature. If I’m reading your snippet right, GATs let you express exactly that, though minus `template`’s duck-typiness so you’d have to s…
>less expressive in some ways, but fitting Rust way better, as basically a relaxation of a former restriction, rather than a new feature They're not expressive enough to implement a monadic async library, as far as I'm aware, so they don't fulfill the role of proper HKTs in this context. >minus `template`’s duck-typiness so you’d have to spell out what contract the container must adhere to. Do you think it's consiste…
AIUI you need GC in order to do that. There's a reason why Rust's async/await support needs compiler magic.
(I'd like to see standard interfaces for "pluggable" garbage-collected arenas in Rust, but this will need to wait until after Allocators/Storages get fully stabilized.)
Re: The Rust I wanted had no future
#303Earlier quoted context omitted.
Performance, but with sanity. Say you use a vector in C++. You push one element and pop two. In Rust that's a None. In C++ the answer is UB (in my case 43).
In C++ it is an error, if one bothers to enable bounds checking. https://godbolt.org/z/vYcMhE9h7 > Error: attempt to access an element in an empty container.
Re: The Rust I wanted had no future
#304Earlier quoted context omitted.
Performance, but with sanity. Say you use a vector in C++. You push one element and pop two. In Rust that's a None. In C++ the answer is UB (in my case 43).
And what should be defined behavior? There are quite a few choices that depend on particular situations. Feature designers have no knowledge about what would you want so they left it up to application programmer to check the situation upfront and act accordingly to their wishes. If you want same behavior across the whole application you can always write generic function doing just that.
Re: The Rust I wanted had no future
#305Earlier quoted context omitted.
I'm interested in more on this. What can I do in C++ that I can't do in Rust?
Write unsafe code wrapped in layers of those advanced features that half the team didn't even know existed, and push it into production.
Re: The Rust I wanted had no future
#306I never understood that one either. There is always only one "solution" that will make your program compile, so why not just let the compiler figure it out?
Re: The Rust I wanted had no future
#307Earlier quoted context omitted.
To me, one thing missing from most popular web languages is the single best part of Rust: A well-defined handling of the non-happy path. I'm talking about things like exhaustive "switches", built-in, ENFORCED handling of "missing" values (null, undefined), and finally useful error handling. I actually don't need any of the baremetal features of Rust. It's just that most of it's "zero-cost" abstractions are still far…
Haskell, Scala, F#, OCaml. (Some dislike it, but Java’s checked exceptions are exact homologous of result types)
Outside of that, yeah they just differ in very low-level aspects that most developers don't even know about.
Re: The Rust I wanted had no future
#308Re: The Rust I wanted had no future
#309Earlier quoted context omitted.
Developers should learn the difference between concurrency and parallelism because async isn't equivalent to threading.
Yep, it's pretty alarming that a developer would toss away async when threading isn't a fit for all situations - what happened to the right person tool for the job? As a professional, I 'hate' some things too, but I'm not going to blindly make my work harder and less efficient out of some small preference I have.
Re: The Rust I wanted had no future
#310I maintain the actor model is probably the most theoretically perfect concurrency and distributed computing model. The holy grail. We just don't have the right hardware for it and it's extremely limited by addressability issues with current technology.
So I don't really find this surprising, nor disagreeable. It's just not a model that Works Well at present.