From: Florian Gross Date: 2004-11-14T03:23:24+09:00 Subject: Re: assert Gavin Sinclair wrote: > Are you suggesting that all breakpoint would only be enabled in debug > mode, or just the 'assume' ones? What kind of debug mode do you mean? > $DEBUG? Only the assume ones. Yup, I was referring to $DEBUG. >>What would you think about an assume() method that could take either a >>block or a String? > > I agree it looks nicer, but I feel that breakpoint_unless is actually > a more appropriate name, even though it's a little ugly. 'assume' > doesn't tell you what it does. Setting breakpoints in this manner is > such a specific and irregular thing to do that I think the name needs > to be clear. assume {} states an assumption that your code does. If it isn't met then something went wrong and you're now in a code branch that is completely unhandled and that should not occur. The traditional C version (called assert, but I can't have that name anymore because of test/unit, I suppose) figures that it would be best to shut down the application completely now. This one instead tells you that something went very wrong and gives you a chance of examining why and how things went wrong. The latter part is a detail, it need not be known to understand that assume {} states an assumption. I guess there could even be an implementation of it that fails just like assert in C instead of setting a breakpoint.