<div>It would be easier to catch and therefore to test with a specific subclass of Exception.</div>  <div>Besides, for the Interval&gt;&gt;remove: example, the code would have been:</div>  <div>&nbsp;</div>  <div>Interval&gt;&gt; remove: anElement<BR>&nbsp;"elements cannot be removed from an Interval"</div>  <div>&nbsp;^self shouldNotImplement</div>  <div>&nbsp;</div>  <div>Mind you, even in VW you have these calls of error:, and shouldNotImplement is implemented that way...</div>  <div>But why not implementing shouldNotImplement like:</div>  <div>&nbsp;</div>  <div>Object&gt;&gt; shouldNotImplement</div>  <div>&nbsp; ^ShouldNotImplementError raise</div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div><BR>Markus Gaelli wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi Stef,<BR><BR>let's have a look a the following example:<BR><BR>Intervall &gt;&gt; remove: anElement<BR>self error: 'elements cannot be removed from an
 Interval'<BR><BR>What do you mean with "trapped more specifically"?<BR><BR>I would claim that almost all (happy for any counter example) uses of <BR>"self error:" are indicating that some (maybe implicit) precondition <BR>fails.<BR>Being radical I would say in above situation the precondition just <BR>fails always, meaning that this method would never make sense to be <BR>called on Intervals.<BR><BR>Using traits we shouldn't need the strange idiom to overwrite <BR>template or other superclass methods, that do not work in special <BR>subclasses, any more.<BR>(It would be really tedious to enumerate all methods on all classes <BR>which do not work... ;-)<BR><BR>If the error string is telling me why the precondition fails, good. <BR>Why would I want to bother with different kinds of exceptions here?<BR><BR>By the way, I call a test, which tests the failing of a precondition, <BR>"pessimistic method example", but I am still open for a better name.<BR>People did not like the name
 "counter example" or "negative example", <BR>though I still would prefer one of these names and I am about to <BR>rename...<BR><BR>Cheers,<BR><BR>Markus<BR><BR>On Mar 1, 2006, at 10:29 PM, stéphane ducasse wrote:<BR><BR>&gt; Hi all<BR>&gt;<BR>&gt; I asked students of my lecture to write SUnit tests for some <BR>&gt; collections and I noticed that in Squeak<BR>&gt; the collection library do not use specific exception but instead <BR>&gt; use error:.<BR>&gt; The consequence is that it can be tedious to capture only specific <BR>&gt; error. I was wondering what is the<BR>&gt; general feeling about this state. In VW they have various exception <BR>&gt; that can be trapped more specifically.<BR>&gt;<BR>&gt; Stef<BR>&gt;<BR><BR></BLOCKQUOTE><p>
                <hr size=1><font face="Arial" size="2">To help you stay safe and secure online, we've developed the all new <a href="http://us.rd.yahoo.com/mail/uk/taglines/default/security_centre/*http://uk.security.yahoo.com/"><b>Yahoo! Security Centre</b></a>.</font>