On Thu, Sep 4, 2008 at 05:01, Michal Suchanek <hramrach / centrum.cz> wrote:
> There are also parts in Ruby core and stdlib that still depend on
> global constants for returning results. I find this very hard to use,
> leading to unreadable code and possible treading problems.
>
> The one I saw recently is IO::popen. It returns the PID of the created
> process in $?. Unlike some of the Regex methods this one really stores
> a piece of information that is otherwise inaccessible into a global
> variable. Given that Ruby supports threading, and even real concurrent
> threads in 1.9 this is a disastrous interface.

I should note that $?, along with $_ and many regexp-related
variables, is actually thread-local, despite its apparently-global
name.

More magic, I agree. But at least they're already safe.