Neil Stevens wrote:
> Neil Stevens wrote:
> 
>>My mistake, heh.  I wonder how many who use them know that, though, and
>>how many just do it without checking because it's popular in perl or
>>popular on here.
> 
> 
> Hold on, this wasn't really my mistake, I think.  How is one supposed to
> know a dollar-sign variable isn't always global?
> 
> This sounds to me like some special-case hackery done to keep careless
> coders from shooting themselves in the foot.
> 

Usually if you think about what the variable represents, it's obvious 
whether it should be thread-local or global, and ruby does it that way. 
(Results of something the thread did, like call an external process, or 
match a regex--those are thread local. Environment that was given when 
the program started--those are global.) The local/global distinction is 
not hackery, but the notation (inherited from perl) is not great.

I do kinda wish there was a consistent visual cue of some kind, like 
$$foo for global and $foo for local, or $foo for global and $_foo for 
local. It would also be nice to have a faster way to access user-defined 
thread vars: $_foo versus Thread.current[:foo].

-- 
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407