Why people dislike global variables so much while I find them so convenient?

bauss jj_1337 at live.dk
Wed Jan 26 09:41:40 UTC 2022

On Wednesday, 26 January 2022 at 09:04:27 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 26 January 2022 at 08:49:02 UTC, bauss wrote:
>> I think it's especially important for compilers to not use 
>> global state because you want to be able to localize every 
>> single issue right away to a specific unit in the compiler.
> I would think that you sometimes can gain a bit of performance 
> by making the symbol table global (as you don't have to rebuild 
> it for every source file), but it can become rather large so 
> there is a trade-off.

Well you could pass the symbol table to each step rather than 
each step accessing the symbol table themselves.

But of course it all depends on your situation and what your 
goals are.

It makes sense to use globals in some cases and in others it 

I think the problem with globals is just how easy you can screw 
up using them, but when used right they can be useful.

More information about the Digitalmars-d mailing list