Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Consider this simple C code:

    void inc(int* a, int* b) {
      *a += 1; *b += 2;
    }
Are you adding one to an integer and adding two to another integer, or are you adding three to a single integer?

In other words are the two pointers actually pointing to the same variable? There's no way to know. When you select one pointer, should the other also be highlighted?

But in Rust you cannot have two mutable references to a single variable so the above cannot happen.

Variable renaming is a much much simpler task than this. Of course it is archaic and has existed for a long time.



> In other words are the two pointers actually pointing to the same variable?

This statement is incorrect. You can't have pointers to a variable. You can have pointers to a memory address, and most people would be fine with a tool that is correct up to the level of being unable to differentiate that.

This is a disingenuous redefinition of what the GP is looking for in order to shill Rust.


honestly I'd be ok with a being treated as different than b in this colorized use case. sure, maybe it'd be "bug inducing" or be a subconcious push toward human brains to forget they produced two aliases etc but I think what you're proposing with the c colorizing is impractical and yes I get it, "the tools caused the crash that brought down civilization" but c'mon, if you're still using c, folks have already talked you out of safety nets lol




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: