• 0 Posts
  • 41 Comments
Joined 1 year ago
cake
Cake day: July 9th, 2023

help-circle
  • I don’t agree with the previous poster. There’s nothing wrong with diving in and figuring things out as you go, especially if that’s a way that you commonly like to learn. Everyone has different learning styles, and Rust can fit all those styles.

    The main thing to understand is you shouldn’t let compilation errors discourage you. You will get a lot of compilation errors. And I mean A LOT. That’s okay, it’s normal, and it doesn’t mean you’re dumb or that Rust is an excessively difficult language. It generally just means that there’s some new piece of the language for you to learn before you can take your next step.

    When you run into compilation errors, just read the error message carefully and see if you can understand what the problem is. Often the error itself will tell you how to fix it, but you should take the opportunity to understand why the fix is necessary. In every case there’s a reason that the language is putting limitations on what you’re doing. It’s to protect you from bad habits that other languages used to let you get away with. So understand what’s bad about what you were doing and you’ll rapidly grow as a developer.

    If you can’t figure out what’s wrong from the compilation error alone, that’s when it makes sense to turn to the book. The error messages will generally include a reference code which you can use to get more details on the nature of the error. Googling that will lead you to online discussions and maybe entries in the Rust book. Otherwise there isn’t a real need to read through the book from front to back unless that’s a way you like to learn.


  • I’m not trying to shill for Google but I really think it would be a mistake to break up Google without breaking up Microsoft simultaneously if not first. If they actually manage to crack open Google’s search and browser monopoly, who do they really think is going to start filling in that void? Local mom and pop search engines…? No it’s primarily going to be Microsoft with Bing and Edge, and I’m absolutely certain that whatever people don’t like about Google having its monopolies is going to be orders of magnitude worse if Microsoft gains ground there.


  • It makes total sense that new C++ will contain a higher percentage of bugs than old C++, but after being an almost full time Rust dev for the last two years, you will not convince me that new Rust code has more bugs than old C++ code.

    So far I have yet to come across a bug in any of my Rust code that made it into production. All issue reports from users are still related to the C++ code base that we haven’t managed to fully divorce from.

    The only advantage to C++ interop is that managers want to see new code get deployed immediately and continuously. They don’t want to wait until the corporation’s billions (literally) of lines of code are all rewritten in a new language before they start to see the benefits of that transition.





  • Best practice when using .unwrap() in production code is to put a line of documentation immediately above the use of .unwrap() that describes the safety invariants which allow the unwrap to be safe.

    Since code churn could eventually cause those safety invariants to be violated, I think it’s not a bad thing for a blunt audit of .unwrap() to bring your attention to those cases and prompt to reevaluate if the invariants are still satisfied.




  • It’s a massive win, and I would question the credibility of any systems programmer that doesn’t recognize that as soon as they understand the wrapper arrangement. I would have to assume that such people are going around making egregious errors in how they’re using mutexes in their C-like code, and are the reason Rust is such an important language to roll out everywhere.

    The only time I’ve ever needed a Mutex<()> so far with Rust is when I had to interop with a C library which itself was not thread safe (unprotected use of global variables), so I needed to lock the placeholder mutex each time I called one of the C functions.


  • Originally, a qipao was supposed to be a loose-fitting gown

    Source for this? From living in Asia (not in China, but in a predominantly Chinese community), I’ve only seen qipao be form fitting, never loose. Even seeing older pictures of women in qipao, they’re always form fitting. And more often than not, women seem to use them to intentionally highlight their figure.

    Chinese communities tend to have a strong conservative bend, but that doesn’t mean they’re puritanical when it comes to sexuality, especially the sexually suggestive.



  • I do think that specific point is catering too much to sloppy get-it-done-fast-and-don’t-think developers. It’s true that they are Rust’s most untapped demographic, and the language won’t reach the pinnacle of mainstream usage without getting buy-in from that group, but I really think they’ll be won over eventually by everything else the language and ecosystem offers, and .unwrap() won’t be such an unreasonable price for them to pay in the long run.


  • The ideas in the article are great, I’m just a little confused by some aspects of the author’s tone where it sounds like there’s an assumption that the Rust community isn’t interested in expanding the scope of the language to every conceivable use case domain and height.

    For the 4 years that I’ve been paying attention the Rust language is advancing faster than I ever thought a language is able to, but more importantly that advancement has been sound and sensible. So far I haven’t seen a language feature make it into Rust stable and thought “Oh no that was a mistake”, even as features roll in at an incredible rate.

    Compare that to the C++ ecosystem where I feel like almost every new language feature is arriving very slowly while also being poorly executed (not that I think the ISO committee is doing their job badly; I just think it’s effectively impossible to make new language features in C++ without gross problems so long as you demand backwards compatibility).

    I fully expect everything in this very sensible list to make it into the language at a reasonable pace. I don’t object to the “bikeshedding” as much as the author here seems to because I’d appreciate if Rust can avoid painting itself into a corner with bad language design choices the way C++ has. If we’re talking about language ergonomics, I’d rather suffer some tedium now while waiting for a feature to be polished than be stuck in a corner forever in the future because a bad decision was made.

    One example I can think of is I’m not convinced that his proposal around kwargs for function arguments is a good thing, at least not without some serious thinking. For example should it support the ability to reduce foo(a, b, x: x) to just foo(a, b, x) like what’s done for struct construction? If so then the optional arguments start to look too much like positional arguments and the syntax starts to get questionable to me. On the other hand if that simplification isn’t supported then that becomes inconsistent with other parts of the language. So this is something that I believe requires a lot of serious thought, and maybe the better answer is to have built-in macros for generating builder structs

    That being said, the edition system of Rust could afford us some leeway on not being forever trapped with a bad language design choice, but I don’t think we want to rely too much on that.


  • Considering most JIT compilers for JavaScript are written in C++, I can’t conceive of a reason you couldn’t implement one in Rust.

    Is part of your requirement that unsafe doesn’t get used anywhere in the dependency tree? If so you’d have to take away most of the Rust std library since many implementations in there have small strategic uses of unsafe under the hood.

    In my entire software engineering career, which spans embedded systems to CAD applications, I’ve never encountered a case where GOTO is actually needed (but maybe some places where it can be used as a dirty shortcut to save you some lines of code).

    As for arbitrary function pointers, if those function pointers are written in Rust then they’ll come with all the safety assurances afforded to Rust code. I suppose if you’re worried about the danger of running ussr-code with unsafe in it, you could probably have your JIT refuse to compile the unsafe keyword specifically.


  • I think a long time ago a vicious cycle began in the advertising space where predatory ads had more incentive to pay for ad space, so sensible people start to perceive ads in general as predatory. Now no sensible advertiser that’s trying to promote a legitimate product for legitimate reasons will do so by buying ad space, thus reinforcing the increasingly accurate perception that all ads are predatory.



  • And you think lending validity to Israel’s claims that its actions are purely to defend itself from a bigoted terrorist threat is going to help anything?

    There’s an enormous gulf between asking nicely and spreading imagery that implies you want to literally murderer all Israelis. Have you considered that the most effective action may exist somewhere between those two positions? Also I’m very mad at you right now for making me sound like a centrist. Blech.



  • “what could I have done as Winston Churchill or (I think it was) Truman.”

    These people were influential but did not have unilateral power. In their position I would have tried to establish refuge for Jewish people and grant them protective status. Then because of how racist and dumb society was, I would have lost my political position and my influence.