# Rust-style variable shadowing

**URL:** <https://discuss.kotlinlang.org/t/rust-style-variable-shadowing/16338>\
**Category:** Language Design\
**Created:** [February 14, 2020, 5:14pm UTC](https://discuss.kotlinlang.org/t/rust-style-variable-shadowing/16338 "2020-02-14T17:14:43Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Sintinium](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sintinium](https://discuss.kotlinlang.org/u/Sintinium)\
**Post date:** [February 18, 2020, 3:40pm UTC](https://discuss.kotlinlang.org/t/rust-style-variable-shadowing/16338/17 "2020-02-18T15:40:59Z")

</div>

I really like the idea of shadowing a var to a val. There’s been many times I have to change names mid function to prevent mistakes but then I end up using the original name by mistake if I forget I copied it to a val. It would also be nice if this worked with function parameters so you can change the parameter and continue using the same name to prevent confusion.

---

_[View the full topic](https://discuss.kotlinlang.org/t/rust-style-variable-shadowing/16338)._
