From: Florian Gross Date: 2004-11-18T01:13:15+09:00 Subject: Re: assert Gavin Sinclair wrote: > The question is: what > method name is most acceptable? 'breakpoint_unless' is a bit long (I > don't care, but others probably do). Florian likes 'assume' but I > think that's unclear -- at least it's not clear that it concerns > breakpoints. I actually consider that a feature. The interface isn't bound to Breakpoints either. It can make sense to have various actions on a failed assumption and it would be nice if other's could be fit into the same interface. > So I thought of introducing a module, giving us > > Breakpoint.bp_unless > Breakpoint.bp_if > Breakpoint.bp_trap # for trapping signals > > and whatever other smart things people think of. But that's not > clearly a good idea. The module already exists. (See Breakpoint.activate_drb) However it is a pain to have methods both inside the Module and in Kernel because that alters the caller's binding. > But your post gave me this thought: > > breakpoint? 'b != 5' # breakpoint if b != 5 > > The question mark suggests "conditional breakpoint", a term we're all > used to from debuggers, I'm sure. That might be the best idea yet. > I'm just not sure which logic to use: > > breakpoint? 'b == 5' # breakpoint unless b == 5 > > or > > breakpoint? 'b == 5' # breakpoint if b == 5 Can we have this as an alias for assume()? I like it better than the breakpoint_unless/if forms.