Top "Scope" questions

Scope is an enclosing context where values and expressions are associated.

Non-declaration statement outside function body in Go

I'm building a Go library for an API that offers JSON or XML formatted data. This API requires me to …

variables scope go package global
Preserving a reference to "this" in JavaScript prototype functions

I'm just getting into using prototypal JavaScript and I'm having trouble figuring out how to preserve a this reference to …

javascript oop scope this prototype-programming
How to make a variable inside a try/except block public?

How can I make a variable inside the try/except block public? import urllib.request try: url = "http://www.google.…

python python-3.x scope local-variables try-except
cmake variable scope, add_subdirectory

I have a CMakeLists.txt in my project root and one in my /src folder. The one in the /src …

scope cmake
Global dictionaries don't need keyword global to modify them?

I wonder why I can change global dictionary without global keyword? Why it's mandatory for other types? Is there any …

python dictionary scope global-variables global
Set "this" variable easily?

I have a pretty good understanding of Javascript, except that I can't figure out a nice way to set the "…

javascript variables scope this
Surprised that global variable has undefined value in JavaScript

Today, I got completely surprised when I saw that a global variable has undefined value in certain case. Example: var …

javascript scope
Creating a class within a function and access a function defined in the containing function's scope

Edit: See my full answer at the bottom of this question. tl;dr answer: Python has statically nested scopes. The …

python namespaces scope
How does angular application handle refresh page and could we use $history on loading directives

So two questions. How does angular applications handle refresh page, b/c from what I heard, $rootScope destroy() on refresh …

angularjs scope refresh history preserve
Making code internal but available for unit testing from other projects

We put all of our unit tests in their own projects. We find that we have to make certain classes …

c# unit-testing scope