• 3 Posts
  • 720 Comments
Joined 5 years ago
cake
Cake day: May 31st, 2020

help-circle

  • Not if you never get your application into production…

    Insert tips head GIF here.

    I wish this was as much of a joke as I’m pretending. It’s so common for software projects to get cancelled that lots of tooling differences are just in terms of how long they let you not deal with long-term problems and how violently they do then explode into your face.

    For most of the development lifecycle of a GCed project, you’re gonna ignore memory usage. And if you’re lucky, it can be ‘solved’ by just plonking down a thiccer piece of hardware…



  • Ah, interesting. I went from garbage-collected languages where thinking about ownership might be useful for keeping complexity low and occasionally comes up when you manage lists of objects, but ultimately isn’t needed, to Rust where well-defined ownership is enforced by the language.

    So, I wasn’t aware that ownership is even as concrete of a thing in other languages…


  • Ephera@lemmy.mltoMemes@sopuli.xyzWhich one are you?
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 days ago

    A local shop here only has shopping carts, no baskets. You can get smaller shopping carts, and in fact even shopping carts for toddlers to push around, but you still need a coin for those.

    And yep, I’ve genuinely been stood in front of that shop and went back home, because I didn’t have an appropriate coin. I think, even twice already.
    I could have bought a small item to have them hand me out coins and then done another loop with the shopping cart, but yeah, there was just no way, I’d waste that much time.


  • Ephera@lemmy.mltoMemes@sopuli.xyzWhich one are you?
    link
    fedilink
    English
    arrow-up
    5
    ·
    5 days ago

    Interesting. Presumably, enough of their customers now show up without the appropriate coins, due to electronic payment methods being available otherwise, that they decided to not require coins.

    Here in Germany, where we hold onto cash a bit more dearly due to our Stasi-past, I don’t know any shop where I can take a shopping cart without sticking a coin in…








  • Ephera@lemmy.mltoADHD memes@lemmy.dbzer0.comSkin Velcro
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    6 days ago

    Dry skin is mostly caused by not enough oils being on your skin, which normally prevent the water from escaping. You’ll have a hard time hydrating so much that that’s no problem at all.

    But at the same time, the cheapest lotion will do the trick. In principle, you can even use sunflower oil or similar. The water isn’t picky from what oil it gets blocked…


  • Yeah, these become a lot less relevant with routine.

    • Avoiding the main-thread panicking is mostly just a matter of not using .unwrap() and .expect().

    • String vs. &str can mostly be solved by generally using owned datatypes (String) for storing in structs and using references (&str) for passing into function parameters. It does still happen that you forget the & at times, but that’s then trivial to solve (by just adding the &).

    • “temporary value dropped while borrowed” can generally be avoided by not passing references outside of your scope/function. You want to pass the owned value outside. Clone, if you have to.

    • “missing lifetime specifier” is also largely solved by not storing references in structs.


  • The thing with OOP, particularly how it’s used in GCed languages, is that it’s all about handing references out to wherever and then dealing with the complexity of not knowing who has access to your fields via getters & setters, or by cloning memory whenever it’s modified in asynchronous code.

    Rust has quite the opposite mindset. It’s all about tracking where references go. It pushes your code to be very tree-shaped, i.e. references typically¹ only exist between a function and the functions it calls underneath. This is what allows asynchronous code to be safe in Rust, and I would also argue that the tree shape makes code easier to understand, too.

    But yeah, some of the patterns you might know from OOP will not work in Rust for that reason. You will likely need to get into a different mindset over time.

    Also just in case: We are talking OOP in the sense of the paradigm, i.e. object-oriented.
    Just using objects, i.e. data with associated functions/methods, that works completely normal in Rust.

    ¹) If you genuinely need references that reach outside the tree shape, which is mostly going to be the case, if you work with multiple threads, then you can do so by wrapping your data structures in Arc<Mutex<_>> or similar. But yeah, when learning, you should try to solve your problems without these. Most programs don’t need them.