lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The last time I checked our work in progress codebase of a game project had about 2000 global functions. Nothing wrong with them. Actually, it’s pretty handy to be able to live update any of them. Plus autocompletion, ref browsing and other IDE must-haves work out of the box because there’s no renaming / namespacing going on.

”globals are evil” usually refers to mutable global state. We have that too, although we try to avoid it if possible (grouping global vars into namespaces helps).

With this backstory you probably understand why having to prefix every global with $ would make our eyes hurt...

I also think typos in variable names are pretty easy to find and fix. On the other hand when doing large refactorings to the codebase, some sort of optional static type checking for function args and automatic type inference for vars would be very useful. A much more difficult problem unfortunately...

Cheers,

Petri