Questions tagged [scope]
Scope is an enclosing context where values and expressions are associated. Use this tag for questions about different types of scope as well for questions where scope may be unclear.
scope
17,641
questions
1
vote
1
answer
20
views
in gnucobol, sub programs of one parent can't invoke each other
I'm currently trying to achieve a pattern to write modest these days' programs in cobol.
By these days' programs I mean a source file with a few variables and procedures visible to each other.
The ...
1
vote
1
answer
48
views
Scopes and middleware
When registering services, one can optionally wrap these in additional middleware.
However, the only way I found to do so in separate and then aggregate was using the .scope function.
I particularly ...
0
votes
0
answers
12
views
Node.js - Making an eventEmitter object be common across different scopes
I am new to node.js and javascript but not coding. This is more of a syntax question of "why does this work?" so I can understand the nuances involved
I defined an emitter object in my main....
0
votes
0
answers
17
views
Difference in Output Between Two Similar C++ Codes with Nested Loops and transform
I'm experiencing a strange issue with two similar pieces of C++ code that are supposed to perform the same task but yield different results.
The problem is around the inner loop statement .
While ...
-1
votes
0
answers
74
views
Are namespaces in C++ the same as those in Python? [duplicate]
Namespaces in Python are "a mapping from names to objects". They're a pretty fundamental part of the language, even making it to The Zen of Python.
As per cppreference, "namespaces ...
1
vote
1
answer
47
views
Absolute prevention of content pollution in output buffer
I have this following code that basically renders partials. However I was trying to find a way to prevent polluting $templatePath variable into the template (the variable is currently accessible from ...
0
votes
0
answers
4
views
How to write a Powershell function that can evaluate "using expressions" both locally without WinRM and remotely through WinRM?
The new IT-issued developer laptops at my org are configured in such a way that fully enabling WinRM is a nightmare - I still can't figure it out. I try to work within lowest-common-denominator ...
1
vote
1
answer
76
views
C pointers: Function returns a pointer defined in its body [duplicate]
I'm learning C using the book C Programming: A Modern
Approach and I have some doubts about the use of pointers
and referencing an out-of-scope variables. I've put together three examples to
...
-1
votes
1
answer
42
views
Variable used inside function reported not used
This works fine:
package main
var foo string
func main() {
fn := func() {
foo = "AAA"
}
fn()
}
But if we move the variable declaration inside main():
package main
...
1
vote
1
answer
73
views
Unqualified name lookup after using-directives in C++
From cppreference :
From the point of view of unqualified name lookup of any name after a using-directive and until the end of the scope in which it appears, every name from namespace-name is visible ...
1
vote
2
answers
108
views
Ambiguous variable reference in C++
I have this piece of code
#include <iostream>
namespace ns{
int a = 10;
}
using namespace ns;
int a = 20;
int main(){
std::cout << a;
}
As per my understanding, when std::cout &...
1
vote
0
answers
89
views
How can I overload a constructor in a private nested class without getting a "Resource Not Found" error when I call Inherited Create?
I have a Managed Record named TEmail with a nested private class called TEmailForm that inherits from TForm. The idea is my email Record can create a modal form as needed for the user to type an email....
0
votes
1
answer
52
views
Variables in Try-Catch blocks with Powershell?
I have been trying to write a script in powershell that renames a file if it does not get transferred correctly through WinSCP. The script looks something like this:
# Variables
$error = 0
$...
0
votes
1
answer
60
views
SwiftUI My Classes dont get injected properly
Im fairly new to SwiftUI and Im trying to build a small game to get used to the syntax but I have the problem that I created a class and created 3 instances in the @main struct but when I try to use ...
-1
votes
0
answers
47
views
Change function's variable inside another function via argument [duplicate]
I want to find how to change a variable via a function that isn't the one that the variable initiated in using the other function's argument (to make it viable for many usages).
Something along these ...