[Pharo-project] Writing a conditions for breakpoint

Igor Stasenko siguctua at gmail.com
Fri Jan 23 12:57:45 EST 2009


suppose, you have a method, say
   foo: bar baz: zork
and want to set a conditional breakpoint for it..
a most easy way to provide a condition is to ask user for providing a
block like:

[:receiver :arguments :context  |  " .... return true to break " ]

but more convenient would be to ask user to write a condition as a method:

 foo: bar baz: zork
   "put your condition code here"
    ^ bar == 0  "break if bar is zero"

then user naturally would access interesting things w/o need to deal
with block-like constructs, where arguments is accessible but in
inconvenient manner
i.e. type 'bar' instead of 'arguments at: 1'

This is very good, except one thing, which i worry about:
what if i want to write a condition which needs to test a specific
context state.
I can freely pass a context in a block, but can't pass it in method ,
because 'condition' method selector should be same as selector where
breakpoint will be installed to.

What you think would be better? Or maybe i should let users decide ,
what is best for them? So, they can write conditions using both forms
- as a block closure or as method?




-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list