Top "Scope" questions

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

How to use unscoped on associated relations in Rails3?

I have a default scope on products due to information security constraints. class Product < ActiveRecord::Base has_many :photos …

ruby-on-rails ruby-on-rails-3 scope arel
Referencing "this" inside setInterval/setTimeout within object prototype methods

Normally I'd assign an alternative "self" reference when referring to "this" within setInterval. Is it possible to accomplish something similar …

javascript scope lexical-scope
How to inject variable into scope with a decorator?

[Disclaimer: there may be more pythonic ways of doing what I want to do, but I want to know how …

python scope closures decorator python-decorators
Please explain the use of JavaScript closures in loops

I have read a number of explanations about closures and closures inside loops. I have a hard time understanding the …

javascript loops scope closures
What's the difference between a global var and a window.variable in javascript?

I'm reading the backbone.js documents and seeing a lot of code that assigns attributes to the window object: window.…

javascript attributes scope
Angular $scope.$apply vs $timeout as a safe $apply

I'm trying to better understand the nuances of using the $timeout service in Angular as a sort of "safe $apply" …

angularjs scope
scala class constructor parameters

What's the difference between: class Person(name: String, age: Int) { def say = "My name is " + name + ", age " + age } and class …

scala constructor scope immutability
Why enclose blocks of C code in curly braces?

I am looking at some C code, and have noticed it is full of these curly braces surrounding blocks of …

c scope curly-braces
String with 'f' prefix in python-3.6

I'm trying out Python 3.6. Going through new code, I stumbled upon this new syntax: f"My formatting string!" It seems …

python scope string-formatting python-3.6 f-string
Design-time package fails to build - File not found: 'Graphics.dcu'

In Delphi XE2, I have a single control in a pair of design/run time packages. Originally, everything was working …

delphi scope custom-controls delphi-xe2