From: Jim Weirich Date: 2004-11-29T14:22:33+09:00 Subject: Re: What is Ruby for "pimpl"? On Sunday 28 November 2004 11:59 pm, John Carter wrote: First of all ... > Sorry for thinking out loud, excuse me for existing. No need to apologize. Just didn't see where you were going with this one. > On Mon, 29 Nov 2004, John Carter wrote: > Looking at the error message I realized that class A used B which used C > which used D which under certain error conditions that could never occur > while testing A, used E. > > This left me feeling my program was too coupled. Why did the syntax of a > module that I wasn't using block me? The simplest thing to do would just move the require so that it executes only when it is really needed. > -------file A.rb------------------------------------------------------ > class A > def foo > dostuff() > rescue BadThingsHappening => details require 'FixMe' # Move the require to here > b = FixMe.new( details, x, y, z) > b.make_it_all_better > end > > def bah > end > end > ---------------------------------------------------------------------- -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)