
Signature
/los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------
>> 1.) Think of this from the user's point of view: the alert comes up,
>> your code is waiting for an answer, the user can't switch to another
[quoted text clipped - 6 lines]
> But I like the API programming style in that the sheet is displayed and
> I wait for its end, in-line, rather than using a sheetDidEnd selector.
Well, too bad. The right thing to use here is a sheet, and sheets simply
cannot support that inline style of coding. (Not only does the API not
support it, the *concept* does not support it; consider what happens when
showing two sheets on two different windows, and closing them in something
other than LIFO order.)

Signature
Michael Ash
Rogue Amoeba Software
Ben Artin - 21 Nov 2007 03:09 GMT
> >> 1.) Think of this from the user's point of view: the alert comes up,
> >> your code is waiting for an answer, the user can't switch to another
[quoted text clipped - 12 lines]
> showing two sheets on two different windows, and closing them in something
> other than LIFO order.)
Technically, there is nothing conceptually impossible there -- if you use
threads. By the time you pulled that off, thought, you'd be wishing you used
sheetDidEnd directly instead.
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Michael Ash - 21 Nov 2007 04:51 GMT
>> Well, too bad. The right thing to use here is a sheet, and sheets simply
>> cannot support that inline style of coding. (Not only does the API not
[quoted text clipped - 5 lines]
> threads. By the time you pulled that off, thought, you'd be wishing you used
> sheetDidEnd directly instead.
I guess it depends on just how conceptual you get.
I have written an inline sheet API using userland cooperative threading.
It worked, but it turned out to be infeasible to save and restore all of
the thread-specific Cocoa state such as autorelease pools and graphics
contexts, so weird things happened when you used it.
In the larger picture, the sort of implicit contract with the API is that
threads don't happen without an explicit request, and that all GUI happens
on a single thread. You will have to violate this model in some way with
an inline sheet API, so that any code that could potentially be sitting on
the stack when a sheet was invoked would suddenly need to be reentrant,
even code that's many calls up the chain from the code that actually
displays the sheet.
A Cocoa-like API with a different threading model (something like the Be
model of one thread per window would do it) could pull it off, but I don't
think that Cocoa itself can accomodate it even in theory.

Signature
Michael Ash
Rogue Amoeba Software
slashlos - 21 Nov 2007 14:22 GMT
> Well, too bad. The right thing to use here is a sheet, and sheets simply
> cannot support that inline style of coding. (Not only does the API not
> support it, the *concept* does not support it; consider what happens when
> showing two sheets on two different windows, and closing them in something
> other than LIFO order.)
boo hoo; ok, 'uncle' I'm convinced...;-)

Signature
/los "I was a teenage net-random."