I’ve often seen Factorio compared to software development. I’m not a software dev, only a casual programming hobbyist at best. In that context, Gleba spoilage feels like error handling: if things go wrong, do this. If the line spoils, grab it and burn/convert-to-nutrients.

  • xmunk@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    9 days ago

    You can think of it that way - sure. If you want a deeper insight into development I’d just consider it a form of conditional switching. I think back to washing ores in SeaBlock (you’re running recipes that could output one of like six things and sushi-ing is the only real recourse). Some filters might be dealing with success cases, some might be error cases - they aren’t really treated any different at a basic level. The data needs to go where it’s supposed to and exceptions (excepting unhandled ones) aren’t really any different than any other status response.

    Many operations can return multiple states, a “correct” usage of that operation is being able to handle all of those states in a reasonable and planned manner.

    • RustyNova@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      9 days ago

      I feel like it’s more analogous to enum pattern. Your belt is just a array, and your items are enums that may be part of that enum

      So to go back to gleba, nutrient belts are just Vec<Result<Nutriment, Spoilage>>