C
Clifford T. Matthews
I'm new to ruby, so setting $VERBOSE to true is very useful for me.
However, there are some places where I use someone else's library and
I get warnings that I'm not interested in. I can easily wrap the code
with save_verbose = $VERBOSE; $VERBOSE = false; code; $VERBOSE =
save_verbose, but that turns off warnings in my other threads.
Looking at the source to ruby 1.8.3 it doesn't look like it would be
too hard for me to make it so that $VERBOSE would be thread-local. Of
course I've underestimated implementation times before :-(.
Looking up the value of a thread-local variable will take a lot more
time than simply RTEST'ing ruby_verbose, so the naive implementation
might slow things down enough to be a bad idea. On the other hand,
adding a second global variable that specifies whether or not to defer
to a thread-specific variable is conceptually ugly, but means that
people who don't want the slowdown of thread-specific lookup won't
take a hit.
What do others think? If there's a consensus that a particular change
would be worthwhile, I don't mind submitting an RCR and a sample
patch. OTOH, if nobody cares or if someone else wants to run with the
ball, I'm pretty darned lazy and won't mind doing nothing.
However, there are some places where I use someone else's library and
I get warnings that I'm not interested in. I can easily wrap the code
with save_verbose = $VERBOSE; $VERBOSE = false; code; $VERBOSE =
save_verbose, but that turns off warnings in my other threads.
Looking at the source to ruby 1.8.3 it doesn't look like it would be
too hard for me to make it so that $VERBOSE would be thread-local. Of
course I've underestimated implementation times before :-(.
Looking up the value of a thread-local variable will take a lot more
time than simply RTEST'ing ruby_verbose, so the naive implementation
might slow things down enough to be a bad idea. On the other hand,
adding a second global variable that specifies whether or not to defer
to a thread-specific variable is conceptually ugly, but means that
people who don't want the slowdown of thread-specific lookup won't
take a hit.
What do others think? If there's a consensus that a particular change
would be worthwhile, I don't mind submitting an RCR and a sample
patch. OTOH, if nobody cares or if someone else wants to run with the
ball, I'm pretty darned lazy and won't mind doing nothing.