Re: This sort of thing might push me to Scala

Mathieu Bouchard <matju-i8w/[email protected]> Thu, 17 Dec 2009 19:01:10 -0500 (EST)
Newsgroups gmane.comp.programming.language-of-the-year
Message-ID <[email protected]>
On Fri, 18 Dec 2009, Gordon Milne wrote:

> Of all your points I like number 5 best.

it's not mine. i was looking at Cocoa code for the first time in years 
today and found that the code forgot to check for events at all, and that 
this was why the cursor was turning to a spinning beachball.

> However, my runWithWaitCursor() approach is simple and direct

simply and directly a potentially endless source of Bug#23571113: app 
forgets to switch cursor to "busy"; and Bug#23581321: app switches cursor 
to "busy" and back several dozen times per second.

> and, most importantly, I know how to do that without putting a lot of 
> effort into working things out. I am not sure how I would detect a busy 
> program? How would you do that?

ideally you'd let the GUI toolkit do it for you, but if it doesn't do it, 
you'd add a 2nd thread which check whether the main thread is busy, and if 
so, it'd change the cursor. if you have more threads than that then it 
depends on what it means for your programme to be "busy"... you have to 
come up with a definition first.

> Many thanks for points 1 through 4. It is our coding policy that
> insists on the way the code is written.

if you can't change the rules then at least consider the effect that the 
rules have on you and your perception.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801