From: Sean Middleditch Date: 2002-03-27T02:36:20+09:00 Subject: Re: Difference between 'do' and 'begin' On Tue, 2002-03-26 at 12:27, Dave Thomas wrote: > Jim Freeze writes: > > Ok, you have my head spinning now. How would you use this? > > I'm not sure I see many practical uses, but how about > > class Fred > include Wombat > rescue NameError => e > puts "Sorry - you need the Wombat module to run this program" > exit! > end Hmm, well, if you let there be initializers for instance variables in the class definition, it could be really useful. Also, based on your given example, you could have two classes - one a more powerful/complex version that requires outside modules. Then, when you try to create a new instance of the complex one, it could give an error and return a new instance of the weaker class. Does Ruby CVS let you do that now as is? The only other use I can see is allowing it catch any exceptions thrown by any method of the class. I don't think that's what the construct lets you do, tho. > > Dave