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

help-circle



  • Time to delivery is important. Moving quickly withing a language and frameworks that prioritise speed over safety gets a product out the door is important when testing whether a business idea holds merit. Once you’re established with a better scope of the project you should be rewriting this in a static language.

    Dynamically typed interpreted languages should never be used for long term support imo


  • It feels like maybe this could be a code structure issue, but within your example what about something like this?

    fn main(){
        let mut counter = 0;
        let output_array = array.into_iter()
            .map(|single_item| {
                // breaks the map if the array when trying to access an item past 5
                if single_item > 5 {
                    break;
                }
            })
            .collect()
            .map(|single_item| {
                // increment a variable outside of this scope that's mutable that can be changed by the previous run
                counter += 1;
                single_item.function(counter);
            })
            .collect();
    }
    

    Does that kinda syntax work for your workflow? Maybe it’ll require you to either pollute a single map (or similar) with a bunch of checks that you can use to trigger a break though.

    Most of the time I’ve been able to find ways to re-write them in this syntax, but I also think that rusts borrowing system although fantastic for confidence in your code makes refactoring an absolute nightmare so often it’s too much of a hassle to rewrite my code with a better syntax.


  • Oh sorry, I misread what you typed and went on a tangent and just idly typed that in.

    One thing you could do for your situation if you’re planning on iterating over some array or vector of items is to use the inbuilt iterators and the chaining syntax. It could look like this

    let output_array = array.into_iter()
        .map(|single_item| {
            // match here if you want to handle exceptions
        })
        .collect();
    

    The collect also only collects results that are Ok(()) leaving you to match errors specifically within the map.

    This chaining syntax also allows you to write code that transverses downwards as you perform each operation, rather than transversing to the right via indentation.

    It’s not perfect and sometimes it’s felt a bit confusing to know exactly what’s happening at each stage, particularly if you’re trying to debug with something mid way through a chain, but it’s prettier than having say 10 levels of nesting due to iterators, matching results, matching options, ect.




  • Eh, in my experience that’s not how development works. With every new tool to improve efficiency, the result is just more features rather than using your new found time to improve your code base.

    It’s not just from the publishers and shareholders either. Fixing technicial debt issues is hard, and the solutions often need a lot of time for retrospection. It’s far easier to add a crappy new feature ontop and call it a day. It’s the lower effort thing to do for everyone, management and the low down programmers alike.


  • I’m on a 2060 super with Manjaro and I haven’t had any issue with drivers other than when I accidently uninstalled all the drivers at once, and then it was just a matter of running a command found from googling to get it back up and running.

    I haven’t tried an AMD card, and I’m strongly considering it for my next, but I just haven’t seen you have a issues people report.