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

I'm not claiming that rust doesn't have shadowing, just that redefining a variable in a single scope is not really what I would call shadowing.

A shadow is obscuring an object that is still very present, just hidden. That object can be seen again by changing scope.

If there's no way to get back to the original (or the only way back is through a different name), it's not a shadow, just a redefinition. That name doesn't have a shadowed copy, it just has a previous value.

Nothing wrong with redefining a variable either, it's perfectly valid. It's just different than shadowing, in my opinion.



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

Search: