Why do programming languages allow shadowing/hiding of variables and functions?
- by Simon
Many of the most popular programming languges (such as C++, Java, Python etc.) have the concept of hiding / shadowing of variables or functions. When I've encountered hiding or shadowing they have been the cause of hard to find bugs and I've never seen a case where I found it necessary to use these features of the languages.
To me it would seem better to disallow hiding and shadowing.
Does anybody know of a good use of these concepts?