• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    9 hours ago

    Yes, the end goal is very similar to a garbage collector. Both are advanced systems of memory management.

    The most important difference being that a garbage collector runs at runtime, while the borrow checker at compile time. Which means that the borrow checker has 0 impact on the program’s performance. It just takes longer to compile the program.

    Which also means that, while the garbage collector says “you can do whatever you want with memory, don’t worry about it, I’ll handle it for you”. The borrow checker says “you fucking donkey. Why did you do that? I won’t compile this if you don’t fix it”.

    So you trade programmer comfort for performance (end user comfort).