Definitely, I agree that global variables have a place in programming. They 
play an especially important role in low-level software, such as embedded 
programming, as you mentioned, and systems programming. I generally would 
disagree with anyone that says global variables should never be used, and they 
may be the best implementation option when something is "truly global."

However, in R scripting conventions, they are the default. I don't think it is 
controversial to say that in software engineering culture, there is a generally 
held principle that global variables should be minimized because they can be 
dangerous (granted, the original "Globals considered harmful" article is quite 
old, and many of the criticisms not applicable to modern languages). I do think 
it is equally important, though, to understand when to break this rule.

I like your suggestion of documenting this as an alternative option, though it 
seems the general sentiment is against this, which I respect.

Best,
CG

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to