Re:TypeScript 1.4 sneak peek: union types, type guards, and ...
by thomasahle on Thursday November 20, 2014 @12:04PM
(#8636732)
Like python, just `e = equal(...`
[ Parent
| on HN ]
Re:TypeScript 1.4 sneak peek: union types, type guards, and ...
by tomp on Thursday November 20, 2014 @12:24PM
(#8636851)
Python had to go through a lot of pain for that, the "nonlocal" keyword was only added in Python 3.0, and the local/global distinction is very fragile.
Javascript and Coffeescript try to solve this in different ways, most people think that JavaScript's method sucks, and many are not fond of CoffeeScript's non-locality. Personally, I think that demanding variable declaration is still the best option (possibly except for interactive sessions).