From: Gavin Sinclair Date: 2004-11-14T02:09:04+09:00 Subject: Re: assert On Sunday, November 14, 2004, 3:48:28 AM, Florian wrote: >> [ ... breakpoint_unless 'x + y == 10' ... ] >> >> Breakpoint because 'x + y == 10' is false. >> irb> >> >> Is that a convincing benefit? > This does indeed sound nice. >> Now let me ask you: since you proposed >> >> assume { x + y == 10 } >> >> what does that provide over >> >> breakpoint unless x + y == 10 >> >> ? > I think it looks nicer and it can be ignored if the code is not run in > debug mode. 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? > 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. I'm happy with a method taking either a block or a string, though. Gavin