Hacker News new | ask | show | jobs
by hope-striker 2308 days ago
Shadowing is when you have two separate variables with the same identifier. It is beyond obvious that all the x's refer to the same variable in dilap's example. Contrast that with an actual example of shadowing[0], in which it is clear that the same identifier is being used to refer to two different variables.

[0]: https://en.wikipedia.org/wiki/Variable_shadowing#Python

1 comments

I'm using shadowing in the rust sense, not the python sense.
They are the exact same sense!

The exact same idea of shadowing is also present in, for example, sentences in first order logic.