From: Peter Vanbroekhoven Date: 2005-10-19T20:26:16+09:00 Subject: Re: [RCR] Cut-based AOP On Wed, 19 Oct 2005 dave.burt@gmail.com wrote: > What is a cut? Is it a subclass that hides its parent's class? Are the > following two snippets the same? > > cut Bar < Foo; baz() end > > class Bar < Foo; baz() end > Bar = Foo # (except for this warning) Did you mean the following? (Otherwise the class definition of Bar is useless.) Foo = Bar > If not, what is the difference? There are a few subtle differences: * In the second snippet, Foo and Bar are the same. This means that code that changes Foo changes Bar as well. In the first snippet, Bar is invisible to someone using Foo. Changing Foo only changes Foo and leaves Bar alone. * In the second snippet, existing instances of class Foo are not affected, while they are in the first case. So the basic idea is the same, but a cut is designed to keep existing code from breaking. It's supposed to be non-intrusive. That's what a cut does and your second snippet does not. Actually, in the beginning we considered something like your second code snippet, but we decided it was not sufficient for our purposes as we wanted to allow sneaking in a cut into an existing class hierarchy without breaking the code that uses and changes these classes. Peter