Earlier quoted context omitted.
From my experience in C there are two ways libraries deal with not being able to easily pull in their own dependencies. Some of them include their own reimplementations of lots of things (data structures, logging, error handling, date-times). Others decide to keep it simple and only implement a minimal set of functionality which limits their need for dependencies or reinventing the wheel. Cargo letting libraries easi…
I don't know that I have a better suggestion, but the lack of friction on adding new dependencies makes for really hairy dependency graphs. For example, I really loathed having to write this[1] when all I did was write a gstreamer plugin in Rust. I'm not even confident that I got it all the licensing right, and I surely didn't vet every single library in the graph nor will I vet every library during a future cargo-up…
Why Rust?
241–250 of 294 posts
Re: Why Rust?
#242I don't understand why everyone seems to ignore Ada? Granted I am completely new to it, but from what I see it is years ahead of Rust in terms of safety (it can prove correctness!! Rust is only heading into that direction). Yes syntax is verbose, but I dare to believe there must be another blocker than just syntax?
For me it's the borrow checker and lack of shared mutable states stopping me from doing dumb things. Add on things like cargo build manager and crates and it's like a delicious roast dinner smothered in gravy. I've written in Ada95 back in college and it was great but I'm like a duck in water with Rust.
AFAIK, the newest SPARK got borrow checking capability. Also, Ada has excellent design by contract capabilities [1] and constrained subtypes [2].
> Add on things like cargo build manager and crates and it's like a delicious roast dinner smothered in gravy.
Ada has now Alire [3] for that.
> I've written in Ada95 back in college and it was great but I'm like a duck in water with Rust.
Ada is nearing the 2022 standard now. It changed a lot since 95.
PS. I have nothing against you liking Rust. Just wanted to clarify few things.
[1] https://learn.adacore.com/courses/intro-to-ada/chapters/cont...
[2] https://learn.adacore.com/courses/intro-to-ada/chapters/stro...
Re: Why Rust?
#243Earlier quoted context omitted.
I'll bite - I just googled this, and am having a struggle understanding. Is an Algebraic Data Type (ADT) in rust an enum or tuple? I make heavy use of enums (along with structs) as my program foundations. Am I using ADTs? The third type the query shows are unions, which I'm not familiar with.
> Is an Algebraic Data Type (ADT) in rust an enum or tuple? It's the combination of both. Tuples are Product Types . If you treat types as sets of values, then the type (A,B) is the cartesian product of types A and B. For all practical purposes, structs are just syntactic sugar for tuples. Enums are Sum Types . The values of Result are fundamentally just all the values of T plus the values of E (with a tag to tell th…
Re: Why Rust?
#244Most benefits of Rust are true, except in some cases it does not allow you to compile an absolutely valid and safe program like here https://github.com/rust-lang/rust/issues/47680 - unfortunately you don't have freedom of code design decisions! I see some possible problems with refactoring, extending logic and functionality, and lots of issues with async code design and readability. For me, Rust looks like a temporar…
Re: Why Rust?
#245Earlier quoted context omitted.
From my experience in C there are two ways libraries deal with not being able to easily pull in their own dependencies. Some of them include their own reimplementations of lots of things (data structures, logging, error handling, date-times). Others decide to keep it simple and only implement a minimal set of functionality which limits their need for dependencies or reinventing the wheel. Cargo letting libraries easi…
I don't know that I have a better suggestion, but the lack of friction on adding new dependencies makes for really hairy dependency graphs. For example, I really loathed having to write this[1] when all I did was write a gstreamer plugin in Rust. I'm not even confident that I got it all the licensing right, and I surely didn't vet every single library in the graph nor will I vet every library during a future cargo-up…
cargo lichking is an example, and I think cargo deny has similar functionality?
Re: Why Rust?
#246I saw a YT video about how safe Rust is. I want to give it a try but I do mainly web applications, where I use Spring Boot and front-end frameworks. From what I have read Rust is better for system level or regular applications (not web apps). Can modern web applications be built efficiently with Rust? And by efficiently I mean, is the ecosystem there (libraries and tools). I imagine the following would be needed.. 1)…
Can you explain why DI needs an entire framework/libary?
When I was taught DI in school, I was given the impression that DI was a $1000 term for a $5 concept in that without DI, you write code like this:
class Foo(object):
def __init__(self):
self.bar = GetBar()
whereas with DI, you write this: class Foo(object):
def __init__(self, bar):
self.bar = bar
Obviously, I'm grossly misunderstanding what DI is, because if that's really all it was, you wouldn't need a DI framework. I just haven't had to write code using any sort of DI more complicated than that.Re: Why Rust?
#247Earlier quoted context omitted.
> Rust code, on the other hand, often doesn't look much more elaborate than code I write in much higher level languages I'm curious to see an example. Could you show something written in Rust, or another "much higher level language" that you think would be messier or more difficult to write in C++ ?
The enum example in the article
event.SetKeyPress(ch);
event.SetMouseButtonPress(pos, but); etc
...
switch (event.type) {
case EvKeyPress: ch = event.GetKeyPress();
Re: Why Rust?
#248I wish C++ has a universal dependency manager like crates. It feels like every external library I want to use requires their own exotic setup.
Yes, but C/C++ is straightforward also. You simply need the source and link it or get a library object file (.lib or .so) and the header files. IDE's like Visual Studio hide this behind tons of settings and dialogs but in the end it's simple if you know the above.
cargo just works, and isn't really complex in design. just less anticated.
Re: Why Rust?
#249Earlier quoted context omitted.
Yes and no, both. That really depends on what government and what control. But anyway, the amount of value you can provide there is severely limited, as you can only at most undo the value your government is destroying. You can't ever get in a better situation than what you would get with a competent liberal-ish government and no cryptomoney. That means some business can exist there, and a small amount of it can even…
> You can't ever get in a better situation than what you would get with a competent liberal-ish government and no cryptomoney. And what if you have only an incompetent authoritarian government? How would you help fight citizens of those governments? Crypto is a great tool there. Just because there are insufferable crypto-bros peddling shitcoins to make a quick buck doesn't mean entire Crypto field is useless. That'd…
Then cryptomoney can give you a limited, non-zero amount of value. Still less than fixing the government, but it is easier to deploy.
Even then, comparing it with the internet boom is bullshit.
Re: Why Rust?
#250I don't understand why everyone seems to ignore Ada? Granted I am completely new to it, but from what I see it is years ahead of Rust in terms of safety (it can prove correctness!! Rust is only heading into that direction). Yes syntax is verbose, but I dare to believe there must be another blocker than just syntax?
I did some ADA in the past and yes, it is a nice language, but it lacks the modernity and a dynamic community like Rust. ADA did received some nice update to its specification, but, just like C++, it struggle / cannot really fit the latest innovation in programming language that easily. And to be fair, it is fine. ADA is very much a "committee" language (its spec are ISO/IEC) instead of a "community" language (all th…
I'm still learning both Ada and Rust, so please keep that in mind. Nevertheless, I humbly disagree. The more I learn Ada and other "old" languages the more it looks to me like "modern" ones rediscover things that have been present in other languages for years.
The really significant difference I can see for now is that Ada is not focused so strongly on functional programming paradigm and it has no async/await sugar. Rust borrow checker is a strong success of course and was another significant difference, but latest SPARK got borrow checking capabilities too, AFAIK.
While Ada's open-source community is smaller, I find it as energetic and devoted to improving the ecosystem as Rust's. I have no idea about closed-source community, but in the past 4 years ArianeGroup [1], Airbus [2] and Nvidia [3] talked about choosing Ada for their high-integrity applications.
> And to be fair, it is fine. ADA is very much a "committee" language (its spec are ISO/IEC) instead of a "community" language (all the spec and rfc of Rust are on github and anyone can easily discuss them).
You can discuss Ada/SPARK RFCs on Github too. [4] I think I once saw on Ada forum or chat that someone proposing changes to the language was simply invited to talk to people working on the standard, so it doesn't look like the language is developed in isolation or something.
> This makes it so that ADA doesn't get the attention, and the rapidity of innovation, that a language like Rust does, but ADA is mostly made for program that will need to be maintained in critical operations for decades with the code being maintainable and compilable far into the future.
I think that Ada adopted quiet quickly to changing world with Rust as its inspiration: lower entry barrier toolchain, compelling licensing, library distribution, RFCs, etc. And in terms of language features, in many areas it's not only on par, but ahead of competition. So you're less likely to see lots of changes, but they do happen nevertheless. I'm not saying Ada is perfect, of course. There are parts of it that other languages do better. No shame in that.
IMHO, the reason Ada is unknown to many people is a combination of its past, myths surrounding it, and general trend of people to follow trends. ;) But currently I find Ada/SPARK even more compelling option than Rust, even though I like both.
[1] https://www.facebook.com/ArianeGroup/posts/2872955946126067
[2] https://www.manufacturing.net/aerospace/news/21175187/airbus...
[3] https://blogs.nvidia.com/blog/2019/02/05/adacore-secure-auto...