<div class="gmail_quote">On Tue, Mar 25, 2008 at 8:02 PM, Matthew Fulmer &lt;<a href="mailto:tapplek@gmail.com">tapplek@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="Wj3C7c">No. Traits are units of behavior that can be shared among<br></div></div>
objects.</blockquote><div><br class="webkit-block-placeholder"></div><div>So...if in a general sense a trait has no knowledge of the object it will be attached to, is it common practice to create traits to be used only by a specific group of objects so that some common behaviour can be assumed?</div>
<div><br class="webkit-block-placeholder"></div><div>Or at that point are you just creating a subclass and should just go ahead and duplicate the methods?</div><div><br class="webkit-block-placeholder"></div><div>As a trivial example, say you have Dog and Rock, and you want to make a Pet out of both of them even though they both have different base classes (like Animal or Mineral). &nbsp;Furthermore, Pet&gt;&gt;careInstructions needs to use &quot;self foodRequirements,&quot; which you may provide for a Dog or a Rock, but not for all objects.</div>
<div><br class="webkit-block-placeholder"></div><div>In other words, would you expect to see PetTraits that are meant to be used with Dog or Rock subclasses only?</div><div><br class="webkit-block-placeholder"></div><div>
Thanks!</div><div><br class="webkit-block-placeholder"></div><div>Rob &nbsp;</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div></div>