From: Robert Klemme Date: 2012-05-29T01:18:19+09:00 Subject: Re: Am I justified to use a global variable if it must be used in all scopes? On Mon, May 28, 2012 at 4:56 PM, Peter Zotov wrote: > Robert Klemme ÐÉÓÁÌ 28.05.2012 16:38: > >> In my experience it is extremely rare that I needed global variables - >> so rare I can't actually remember the last time I introduced a global >> variable myself. šIf at all I use pre defined globals like $stderr and >> the like. > > I find it quite likely that you are using singletons a lot. I don't - meaning: I don't use singletons a lot. The same statement I made for global variables is true for singletons and constants as well. Actually I use global state extremely seldom, if at all. I just don't need it they way I write software. > I'd say that in Ruby, constants are pretty much scoped global variables. Correct. > Note that I'm not saying this is necessarily bad; I just mean that there's > not much difference between "singletons" and "global variables". Both > represent global state, and the global state itself should be regarded as > possibly harmful, not particular manifestations of it. Absolutely agree. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/