In computer programming, the scope of an identifier is the part of a computer program where the identifier, a name that refers to some entity in the program, can be used to find the referred entity.

learn more… | top users | synonyms

3
votes
2answers
103 views

Handling signals in Python inside a function

I have code that needs to exit gracefully. To simplify things, I am presenting an example based on the answer given here. Since I need to handle a few signals, I thought of putting this logic in a ...
3
votes
2answers
63 views

Initializing variable outside loop [closed]

Is this good practice? int a; while(true) { a = foo(); // a is only used in this loop not outside of it // some more code ... } Or should the variable ...
1
vote
0answers
22 views

For loop in javascript [closed]

Whether it is Java, C#, C++ syntax for the for loop looks like that: for (int i = 1; i <= 5; i++) { // something } ...
4
votes
1answer
41 views

Communicating between plugins whilst maintaining context in Javascript

I'm making some changes to a JavaScript plugin on a site I've been made steward over. This main plugin has it's own sub-plugins and I'm trying to make certain aspects modular. Currently, I'm ...
7
votes
2answers
107 views

Conway's Game of Life - Conventional JavaScript?

I'm using the Game of Life Kata to help me learn JavaScript. I've picked up the syntax through Codecademy tutorials, but my current skill level is Novice. The example code has working functionality ...
8
votes
2answers
120 views

Advice needed for scopes in JavaScript

I would like to connect this "JS" to Bugzilla (example: bugzilla.mozilla.org or landfill.bugzilla.org). I started to learn JS language today and I would like to ask you: How can I not do bad ...
1
vote
1answer
106 views

Order and visibility tracking algorithm (e.g. scope visibility)

I have a tree of objects. ...
2
votes
2answers
153 views

Is this JavaScript/jQuery methodology good?

I am seeking critique on what has become my normal methodology of writing JavaScript code. I have become heavily reliant on the jQuery library, but I think this has helped me learn the native language ...
0
votes
0answers
506 views

Rails chained scopes to build form filters

So I have a form in rails to filter the results. It is working right now but I find it ugly and I'm pretty sure there are better ways to do it. Here is what it looks like in my model, view and ...
1
vote
1answer
120 views

using C scope syntax for code organization purposes [closed]

Would you ever use curly braces for making your code more organized and readable? for instance I could have: ...
2
votes
2answers
406 views

iOS/Objective-C “if” best practice

I've got this code that I found in a project and I'm wondering how can it be done better: ...
1
vote
2answers
297 views

PHP Class Inheritance / Object Instantiation / Object / Property Scope w/ Child / Parent Classes & Dependency Container Class

In PHP, I have a parent/child class and am using dependency container to load them. I am trying to use the same database connection on all of them without duplicating the object. CLARIFICATION: MY ...
0
votes
1answer
57 views

Is declaring a property as `public` insecure?

I posted a question few weeks back, on making a PHP Login Script. Most of you guys told me not to use global variables and especially for something like MySQLi ...
2
votes
1answer
113 views

Better way to avoid trapping vars in a closure's scope?

I have a quandary with regard to exactly how the JavaScript scope chain works in a particular situation, and despite my searching and reading I am still mainly working on assumptions. I was wondering ...