
Nov. 27, 2014
2:24 p.m.
On Thu, Nov 27, 2014 at 11:30:40PM +1100, Chris Angelico wrote:
You could abuse try/finally for this purpose.
try: whatever you need to do finally: my_widget.setFocus()
I thought about this solution, but I am concerned about communication of intent. Using the try communicates to a code reader that the code inside is expected to throw, which is not the case. However, I agree there are good alternative strategies.