• 0 Posts
  • 54 Comments
Joined 2 years ago
cake
Cake day: July 9th, 2023

help-circle
  • There are several ways to achieve an effect equivalent to operator overloading in Rust, depending on exactly how you want the overloading to work.

    The most common is

    fn do_something(arg: impl Into<Args>) {
        ...
    }
    

    This lets you pass in anything into the function that can be converted into the Args type. If you define the Args type yourself then you can also define any conversion that you want, and you can make any construction method you want for it. It’s a small touch more explicit than C++'s operator overloading, but I think it pays off overall because you know exactly what function implementation all different choices of arguments will be funneling into.

    I’ll admit there’s one thing from C++ that I frequently wish were available in Rust: specialization. Generics in Rust aren’t exactly the same as templates in C++ but they’re close enough that the concept of specialization could apply to traits and generics. There is ongoing work to bring specialization into the language, but it’s taking a long time, and one of my projects in particular would seriously benefit from them being available.

    Still, Rust will have specialization support long before C++ has caught up to even a quarter of the benefits that Rust has over it.


  • Even with modern C++ it’s loaded with seg fault and undefined behavior footguns.

    The times when C++ feels more ergonomic than Rust are the times when you’re writing unsafe code and there’s undefined behavior lurking in there, waiting to ambush you once you’ve sent it to production. Code that is 100% guaranteed safe is always, and I really want to emphasize this: always more ergonomic to write in Rust than it is to write in C++.

    Show me any case where C++ code seems more ergonomic than its Rust equivalent, and I will always be able to show you how either the C++ code has a bug hiding in it or how the Rust code can be revised with syntactic sugar to be more ergonomic than the C++.


  • C++ was far and away my favorite language (I used it professionally for 10 years and was always excitedly keeping up with new ISO developments), until I learned the basics of Rust…

    Now it’s my firm belief that the world will become a better place when C++ stops existing. C++ just has no positive role to play in a world where Rust exists at the level of maturity that it already has.

    Whatever they might try to do to C++ to make it less intolerable will be in vain until they’re ready to break backwards compatibility. And once they’re willing to break backwards compatibility to legitimately improve the language, they’re just going to end up with a messy knock off of Rust.


  • 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.





  • 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.










  • 5C5C5C@programming.devtoLemmy Shitpost@lemmy.worldAnother mystery solved.
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    9 months ago

    Ordinary biomatter is very close to the density of water to begin with. That’s why having a little air in your lungs is enough to be the difference between sinking and floating.

    If Godzilla’s biomatter under 1atm of pressure has a density close to water then being able to compress or expand an empty chamber inside his body by even just a tiny percentage of his ordinary overall volume could be the difference between floating at sea level or sinking to extreme depths.

    Or if you prefer we can imagine that Godzilla gives himself a big ole booty when he needs to come up to the surface and make a mess of things.



  • You’d be right if the cavity is only compressing other organs inside the body without changing the overall volume, but I don’t know why you seem to insist on making that assumption.

    I thought it would be clear from my original description, via the analogy with lungs, that the cavity would not squish the internal organs but rather expand the overall volume of the body.


  • My head canon for sea-based Kaiju is they have a sack of muscles somewhere inside their body that can expand a cavity, kind of like the diaphragm expands the lungs, except instead of taking in air or water it just creates a volume of vacuum inside of them. This makes them extremely bouyant relative to the surrounding sea pressure, so they rapidly ascend and can casually float like a boat near the surface.

    But if they ever want to dive again, they just let that cavity collapse and all their bouyancy goes away.