global Questions

9

Solved

I keep seeing warnings not to use global variables in JavaScript, but it seems that the only reason people say that is because the clogs up the global namespace. I can imagine this being easily fix...
Frum asked 9/5, 2012 at 23:31

5

In TypeScript I can define a global/top-level namespace and use it in another file like so: namespace foo.blah { export function baz() { console.log('hello'); } } And in another file, this ...
Shorttempered asked 23/11, 2015 at 7:45

1

Solved

I have this: #include <iostream> using namespace std; // Variable created inside namespace namespace first { int val = 500; } namespace { int val = 400; } // Global variable //int val = ...
Endomorphism asked 20/1, 2023 at 22:42

10

Solved

What does nonlocal do in Python 3.x? To close debugging questions where OP needs nonlocal and doesn't realize it, please use Is it possible to modify variable in python that is in outer, but not g...
Shana asked 11/8, 2009 at 17:36

3

Solved

I know that having global variables is not appreciated. But in the book, The C++ programming language, by Bjarne Stroustrup, Author says that " The only way to gain control in case of throw from an...
Ebenezer asked 4/12, 2012 at 4:40

4

Solved

A post on here a day back has me wondering how to assign values to multiple objects in the global environment from within a function. This is my attempt using lapply (assign may be safer than <&...
Radie asked 15/3, 2012 at 19:24

5

Solved

I am trying to look for an easy way to define multiple global variables from inside a function or class. The obvious option is to do the following: global a,b,c,d,e,f,g...... a=1 b=2 c=3 d=4 .......
Spermophile asked 6/12, 2016 at 10:20

6

Solved

I have this: g_c = 0 class TestClass(): global g_c def run(self): for i in range(10): g_c = 1 print(g_c) t = TestClass() t.run() print(g_c) how can I actually modify my global variable g...
Protozoology asked 30/5, 2012 at 10:26

6

Solved

i want create SnackBar for reusable(globally) i already created but its only for 1 page , i don't know how to create reusable. below code: import 'package:flutter/material.dart'; class SnackBar...
Diathermy asked 20/2, 2020 at 11:35

3

Solved

So, I've seen other similar issues. There are a lot, but I can't seem to find a solution for this. I've already deleted node_modules folder and package-lock.json file from /{username} , where my pa...
Digitigrade asked 9/11, 2021 at 7:58

9

Solved

I have two controller file homecontroller and backendcontroller. What is the best way to create global function and access it from both files? I found here Arian Acosta's answer helpful but I won...
Darlenadarlene asked 17/5, 2017 at 10:2

5

in this react example from https://reactjs.org/docs/hooks-custom.html, a custom hook is used in 2 different components to fetch online status of a user... function useFriendStatus(friendID) { co...
Alliber asked 22/8, 2019 at 5:45

6

Taking configuration as an example, the Nest.js documentation advocates registering Config Modules and injecting them into other modules in a dependency injection way. The benefits are obvious, and...
Biostatics asked 20/2, 2021 at 12:4

1

I would like to create a global Elementor widget to be called as part of a for each loop. The fields need to be changed based on the arguments I pass to it. What I am trying to do is call the Elem...
Zoochemistry asked 20/5, 2020 at 21:7

1

Solved

I am experiencing an obscure (to me) effect of dundered scoping, and trying to work out the rule for it: #!/usr/bin/env python3 stuff = "the things" __MORE_STUFF = "even more" ...
Ferneferneau asked 10/8, 2022 at 12:59

5

Solved

What is the equivalent to window[my_func_name] in nodejs? I'm reading a string from stdin and if it's a function name I want to execute it. I thought global[my_func_name] might work but unfortunate...
Gawain asked 17/10, 2013 at 18:0

2

Solved

What is the difference in using unnamed namespace and global declaration? Is there any specific context for using these two? Can we access unnamed namespace components in external source files?
Sectarianize asked 14/8, 2013 at 19:3

5

Solved

I am generating an ArrayList of objects. Following is the code ArrayList someArrayList = new ArrayList(); Public ArrayList getLotOfData() { ArrayList someData = new ArrayList(); return someData;...
Gladiatorial asked 14/2, 2012 at 22:15

3

I have gone through following two questions: static and extern global variables in C and C++ global variable in C are static or not? Both questions says the two things in different way. Questio...
Tabitha asked 19/2, 2015 at 15:52

3

Solved

I'm trying to replace all full stops in an email with an x character - for example "[email protected]" would become "myxemail@emailxcom". Email is set to a string. My problem is it's not repla...
Flowerpot asked 9/4, 2017 at 19:28

2

Solved

how can i require a module globally so i can use it in different modules without having to require it again? or do i just have to do that everytime? is there any best practice for this? heres an e...
Frow asked 3/7, 2015 at 17:4

4

Solved

Pylint W0603 states: Using the global statement. Used when you use the "global" statement to update a global variable. PyLint just try to discourage this usage. That doesn't mean you can not u...
Inexertion asked 24/1, 2013 at 14:44

2

Solved

Why mutable struct cannot be defined inside a function in Julia? function test() mutable struct ABC x y z a end end throws error: ERROR: LoadError: syntax: "struct" expression not...
Wordplay asked 24/1, 2022 at 7:22

3

Solved

I'm trying to understand what happens when modules with globals and static variables are dynamically linked to an application. By modules, I mean each project in a solution (I work a lot with visu...
Wreak asked 15/10, 2013 at 3:58

4

Solved

Is it possible to set global variables in a twig file, so that I can access that variables from other files, macros and blocks. For example, I want to have variables.twig file and in it set my var...
Seeger asked 10/3, 2015 at 7:42

© 2022 - 2024 — McMap. All rights reserved.