• 0 Posts
  • 12 Comments
Joined 1 year ago
cake
Cake day: August 4th, 2023

help-circle





  • I agree with the other suggestions so far, to wit:

    1.dyn is fine, when you need it. People will give you a lot of guff about performance but vtable lookup on a dyn is no less performant than the same thing in C++ (in higher level languages almost every call is dynamically dispatched and those are used for plenty of serious, performant work).

    1. Use enums more.

    2. Use traits and generic functions

    And I would add a couple of other thoughts.

    For some DI type work, you can use cargo’s Features to define custom build flags. You can then put variants on the same code (usually implementing a trait) in different modules and use conditional compilation on the Features to swap out which code is used. This is like a compile-time strategy pattern. I use it for testing, but also to swap out databases (using a local in-memory to test and a real one in prod) and to swap out graphical backends on my roguelike (compiles to OpenGL on windows but Metal on my Mac).

    You’ll probably want to learn Rust’s macro system sooner than later as well. Sometimes a macro is better than a function when you need to generically operate over several types (function argument overloading, in other languages) or work on something in a general but well-structured way (tree walking for example).



  • Our administrator is understandably a little bitter about the whole experience as it has unfolded, saying, "We were forced to switch from the perfectly good ESET solution which we have used for years by our central IT team last year.

    Sounds like a lot of architects and admins are going to get thrown under the bus for this one.

    “Yes, we ordered you to cut costs in impossible ways, but we never told you specifically to centralize everything with a third party, that was just the only financially acceptable solution that we would approve. This is still your fault, so we’re firing the entire IT department and replacing them with an AI managed by a company in Sri Lanka.”



  • Out past the planets is the heliopause, the final boundary between the solar system and interstellar space. Voyager discovered it, but other probes have confirmed it. The radiation and particles emitted by the sun create a pressurized bubble around it, where plasma (energized particles, mostly hydrogen) is much denser than past the heliopause. Cosmic rays are more prevalent outside it.

    I’ve heard it compared to the empty zone around where a sink faucet first hits, creating a little “wall” of water around it as the splashing water pushes back the standing water.

    “Empty” space is anything but. There’s tons of particles and energy flying though it, just not as dense.