Hacker News new | ask | show | jobs
by atoav 493 days ago
The problem is however that the internalized advice is shortened to "don't use global variables" and not "avoid global mutable variables when using concurrency".

Constant global variables can be very useful. Mutable global variables can be totally fine in a singlethreaded (e.g. typical embedded) program. I agree that you should still use them with caution, but every advice that says: "don't do $X" should come with instructions under which circumstances it is valid and under which it isn't — and how to get the intended behavior instead with e.g. message queues, locks or whatnot.