From: Nobuyoshi Nakada Date: 2011-02-06T11:07:12+09:00 Subject: [ruby-core:35105] Re: [Ruby 1.9-Feature#4197] Improvement of the benchmark library Hi, At Sun, 6 Feb 2011 03:38:48 +0900, Benoit Daloze wrote in [ruby-core:35103]: > (If it is an Interrupt, I think restoring STDOUT's sync is not relevant.) A library should not leave such globally shared states changed. > #tap is used to return the list of the Benchmark::Tms. > So, your patch would need to store that list in a variable, and return it. `ensure' clause does not affect the return value. So tap trick is not needed here. > Also, sync would never be nil without ensure. > This extra check shows "ensure" is complicating things in this case. > So, I think it is overkill to use ensure here. Consider the case interrupted during `yield'. > On IO#sync's subject, I thought once it would be nice to have a block form of IO#sync, which could use ensure. It's another story, please file new ticket. -- Nobu Nakada