Earlier quoted context omitted.
Sometimes, you just need to know if an idea will even work or what it would look like. If you have to refactor half the codebase (true story for me once), it makes the change a much harder sell without showing some benefits. IE, it keeps you from discovering better optimizations because you have to pay the costs upfront.
In Rust, it's a lot easier to refactor half the codebase than it would be in another language. Once you're done fighting the compiler, you're usually done! instead of NEVER being sure if you did enough testing.
Rust--: Rust without the borrow checker
181–190 of 269 posts
Re: Rust--: Rust without the borrow checker
#182As someone who's only did a couple of small toy-projects in rust I was never annoyed by the borrow checker. I find it nothing but a small mental shift and I kinda like it. What I _do_ find annoying though and I cannot wrap my head around are lifetimes. Every time I think I understand it, I end up getting it wrong.
Re: Rust--: Rust without the borrow checker
#183Earlier quoted context omitted.
>C++ says that all correct programs are valid but the trade is that some incorrect programs are also valid. C++ does not say this, in fact no statically typed programming language says this, they all reject programs that could in principle be correct but get rejected because of some property of the type system. You are trying to present a false dichotomy that simply does not exist and ignoring the many nuances and tr…
Nope. C++ really does deliberately require that compilers will in some cases emit a program which does... something even though what you wrote isn't a C++ program. Yes, that's very stupid, but they did it with eyes open, it's not a mistake. In the C++ ISO document the words you're looking are roughly (exact phrasing varies from one clause to another) Ill-formed No Diagnostic Required (abbreviated as IFNDR). What this…
But kudos to you on writing an irrelevant wall of text.
Re: Rust--: Rust without the borrow checker
#184Earlier quoted context omitted.
Nope. C++ really does deliberately require that compilers will in some cases emit a program which does... something even though what you wrote isn't a C++ program. Yes, that's very stupid, but they did it with eyes open, it's not a mistake. In the C++ ISO document the words you're looking are roughly (exact phrasing varies from one clause to another) Ill-formed No Diagnostic Required (abbreviated as IFNDR). What this…
I'm not sure what your replying to, but it can't be my comment because what you're saying has absolutely nothing to do with it. But kudos to you on writing an irrelevant wall of text.
Re: Rust--: Rust without the borrow checker
#185Re: Rust--: Rust without the borrow checker
#186Earlier quoted context omitted.
You don't think assembly is more tedious to write than C? I don't think that's because of what C does/doesn't "allow" you to do.
Of course it is. C does allow named functions and variables. C doesn’t allow arbitrary jumps. Those are two reasons why C is less tedious than assembly.
Have you heard of longjmp?
Re: Rust--: Rust without the borrow checker
#187For everyone unaware, this repo is a meme: https://www.reddit.com/r/rust/comments/1q0kvn1/corroded_upda... As a follow on to the corroded meme crate: https://github.com/buyukakyuz/corroded > What Is This > The rust compiler thinks it knows better than you. It won't let you have two pointers to the same thing. It treats you like a mass of incompetence that can't be trusted with a pointer. > We fix that.
It does seem like satire. The very first example is: fn main() { let a = String::from("hello"); let b = a; println!("{a}"); // Works! Prints: hello } This is not “I have correct code but Rust can’t tell it’s correct.” This is “wow, this code is intentionally outrageously wrong, obviously dereferences a pointer that is invalid, and happens to work anyway.”
Can you explain why? Why can't both a and b point at the same string object? Does `let b = a;` do something like a destructive move?
Re: Rust--: Rust without the borrow checker
#188Earlier quoted context omitted.
C++ doesn't have low barrier of entry, I almost quit programming as a teen because of C++.
Imo the worst thing about starting out with C++ (which is much better with Rust), is the lack of credible package management/build system that allows you to just install packages. This used to be even more true previously than today. Nowadays, there's stuff like vcpkg, and tons of resources, but I still wouldn't call it straightforward compared to something like nuget or cargo. It tooke me more time to figure out CMa…
APT/dpkg/yast/rpm/pacman/... ?
Make is very simple, you don't even need a makefile. Just type "make main" for main.cpp and it works.
Re: Rust--: Rust without the borrow checker
#189Earlier quoted context omitted.
It’s technically possible to do, just very complicated and hard. Quite often, prohibitively so. Still, the main idea is despite the input files are arbitrarily large, you don’t need an entire file in memory because displays aren’t remotely large enough to render a megabyte of text. Technically, you can only load a visible portion of the input file, and stream from/to disk when user scrolls. Furthermore, if you own th…
What if you don't know ahead of time how big that monitor is that you are displaying stuff on? In any case, what you are describing sounds like an ad-hoc re-implementation of virtual memory?
Re: Rust--: Rust without the borrow checker
#190Earlier quoted context omitted.
I'm not sure what your replying to, but it can't be my comment because what you're saying has absolutely nothing to do with it. But kudos to you on writing an irrelevant wall of text.
It does. The UB is false positives to the question "Is this a valid program".
The fact that some people can only think in terms of all or nothing is really saying a lot about the quality of discourse on this topic. There is a huge middle ground here and difficult trade-offs that C++ and Rust make.