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

It would be weak if that was actually mutating the first “a”. That second declaration creates a new variable using the existing name “a”. Rust lets you do the same[1].

[1] https://doc.rust-lang.org/book/ch03-01-variables-and-mutabil...



Rust lets you do the same because the static typing keeps you safe. In Rust, treating the second 'a' like a number would be an error. In ruby, it would crash.


Let’s rephrase: is naming a variable typing? As for runtime vs. compile errors - isn’t this just a trade off of interpreted languages?




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

Search: