Skip to content

Lexical scoping is not what I expect

3 messages · Duncan Murdoch, Terry Therneau

#
I second Ellison sentiments of "almost never".  One main reason is readability on later 
viewing.
Yes, as Duncan says global variables can sometimes be handy and make functions quick to 
write, but using a formal argument in the call is always clearer.

Terry Therneau
On 06/27/2013 05:00 AM, r-help-request at r-project.org wrote:
#
On 13-06-27 8:18 AM, Terry Therneau wrote:
I didn't say that.  I said that in most cases global variables other 
than functions should not be used.

I would generalize that a little:  global constants are okay, changing 
globals is usually a bad idea.

Duncan Murdoch
#
Duncan,
"I disagree with Duncan" was not at all the intent of my note, but on rereading it does 
have that flavor.  Chastisement accepted.  Due to the documentation angle I'd simply 
change your original "maybe" to "sometimes maybe".  A bit more caution but the same message.
Terry T.
On 06/27/2013 07:24 AM, Duncan Murdoch wrote: