Why do programming languages allow shadowing/hiding of variables and functions?

Posted by Simon on Programmers See other posts from Programmers or by Simon
Published on 2013-10-21T12:04:21Z Indexed on 2013/10/21 16:09 UTC
Read the original article Hit count: 246

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?

© Programmers or respective owner

Related posts about programming-languages

Related posts about language-design