Imperative this and that. Make variable 'x' to '123' (maybe through function call or even method call on an object and 'x' is a member variable, who GAF). Computers today don't like that. Computers like input 'x' and output a new variable that is 123. They are multi-core machines. Multithreading is not just about parallel processing, it's about multiplying the amount of fast memory we have available. Don't fucking touch 'x' MFer! The human brain also don't like that but our brains are too retarded so we convince ourselves that we like things we don't.
If you touch 'x' we need atomics at the very least and possibly some CAS loops, maybe even threads going to sleep. Don't fucking touch 'x'! Read x, output y. You good.
Don't insert element to list. Output a new list with the element added.
What about the copying overhead? What if the list is 2 gigabytes? Then optimize the copies!
We have A->B. There is no need to store B. Store the '->'. Store the difference, the changeset. Then you can do I/O like crazy and throw threads all over the place without worries about thread safety. It's like version control. Store changeset. Don't store the whole file each time. Store the deltas.
How do you get from A to B? Store the difference from A->B, not B. I hate garbage collection normally but it's okay and actually really good here. The design actually calls for it conceptually.
Most Helpful Opinions
I feel like this is what Lex Luther is whispering to himself in his prison cell 😂 in other words, it sounds insane but might be logicalhttps://www.youtube.com/embed/ayD06iaPJ50