|
|
|
|
|
by valty
816 days ago
|
|
This line of thinking led me to think: global variables should be, rather, considered good! Plain text is the problem. We write code so it can be easily read as plain text. Not as living, breathing, running code. Globals are considered bad because they are hard to trace and reason about. But this is only so with plain text. You cannot click on a variable and see all it's dependencies. We must painstakingly trace these. If we visualized the dependencies and the flow of our code, we could see the complexity as we go. And the "context" becomes automatic. There is no difference between explicit and implicit context. The key for globals, is to have one large graph data structure where everything is related. All your data is modeled the same. No mini-databases spread out over the code. No ad-hoc indexes strewn throughout. No modularity. One single giant data model. |
|
I like global variables as well. One awesome thing they enable is custom debug UIs:
http://akkartik.name/post/2023-10-31-devlog
http://akkartik.name/post/2023-11-04-devlog