Python 'global' Keyword Considered Harmful
Looking at Python's global
keyword led me to think how I'd like scoping to work. Some languages have lexical scoping, some dynamic scoping and some a mixture of two. I think scoping should be entirely lexical. My language (let's call it Klop) is dynamically typed, and variables are declared the first time they are assigned, so if you wrote:
x = 0
def f():
return x
def g():
x = 1
return f()
Calling `g()` would return 1. In most languages with lexical scoping you can declare a variable with the same name, at a more local scope. With Klop you can't, and I think that this would make programs more readable.