News for hackers. Stuff that matters.
Re:Want cleaner code? Use the rule of six by _nalply on Saturday September 24, 2022 @03:39PM (#32965912)
One way I try to solve that problem in Rust: use repeated `let thing = simple.invocation();`. No need to rename the variable `thing` if not neccessary. Rust allows redefining a variable with the same name. Additionally I sometimes give the thing a type which makes it even more explicit.

Something like this:

    let thing: Thing = source.prepare();
    let thing = thing.make_iterator();
    let (first, second) = thing.split();
    let first = first.filter();
    let second = second.reverse();
    let items: Vec<Item> = first.join(second);
Just to give an idea how to make a complicated ritual explicit and simple.

This simplifies debugging too. You can set a breakpoint and view the variables or you can use println!.

Re:Want cleaner code? Use the rule of six by jacknews on Saturday September 24, 2022 @09:25PM (#32968148)
oof