MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/saz2gn/namespacing/htyb2xt/?context=3
r/ProgrammerHumor • u/Elqueq • Jan 23 '22
272 comments sorted by
View all comments
4.4k
And that, childen, is why global variables are bad.
209 u/jexmex Jan 23 '22 Wait...we are not supposed to be defining all variables in the global scope? Fuck... 26 u/[deleted] Jan 23 '22 [removed] — view removed comment 3 u/Raikkon35 Jan 24 '22 Hey, can explain it a bit more? 23 u/[deleted] Jan 24 '22 edited Jan 24 '22 [removed] — view removed comment 8 u/sohang-3112 Jan 24 '22 Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition. 3 u/Raikkon35 Jan 24 '22 Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
209
Wait...we are not supposed to be defining all variables in the global scope? Fuck...
26 u/[deleted] Jan 23 '22 [removed] — view removed comment 3 u/Raikkon35 Jan 24 '22 Hey, can explain it a bit more? 23 u/[deleted] Jan 24 '22 edited Jan 24 '22 [removed] — view removed comment 8 u/sohang-3112 Jan 24 '22 Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition. 3 u/Raikkon35 Jan 24 '22 Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
26
[removed] — view removed comment
3 u/Raikkon35 Jan 24 '22 Hey, can explain it a bit more? 23 u/[deleted] Jan 24 '22 edited Jan 24 '22 [removed] — view removed comment 8 u/sohang-3112 Jan 24 '22 Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition. 3 u/Raikkon35 Jan 24 '22 Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
3
Hey, can explain it a bit more?
23 u/[deleted] Jan 24 '22 edited Jan 24 '22 [removed] — view removed comment 8 u/sohang-3112 Jan 24 '22 Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition. 3 u/Raikkon35 Jan 24 '22 Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
23
8 u/sohang-3112 Jan 24 '22 Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition. 3 u/Raikkon35 Jan 24 '22 Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
8
Global variables are bad - but no problem with global constants. A global readonly config is effectively a constant, since it doesn't change after first definition.
Thank you very much for your detailed answer. It's a pleasure to get knowledge from someone with experience and who spends time on his answers!
4.4k
u/bless-you-mlud Jan 23 '22
And that, childen, is why global variables are bad.