Hacker News new | past | comments | ask | show | jobs | submit login

There are only a few use-cases where global variables make sense:

1. Thread container registry with mutex lock for garbage collection and inter-process communication (children know their thread ID)

2. volatile system register and memory DMA use in low level cpu/mcu (the compiler and or linker could pooch the hardware memory layout)

3. Performance optimized pre-cached shared-memory state-machines with non-blocking magic

4. OS Unikernels

Not sure I have seen many other valid use-cases that splatter language scopes with bad/naive designs. YMMV =3






Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: