FROM : John Stiles
DATE : Mon Dec 13 20:38:57 2004
I'd shy away from doing anything to the message dispatch machinery.
It's not something you want to fiddle with.
OTOH, I could imagine a nice template or something that would
automatically build up the catch machinery around your function with
only a little bit of effort. I'd have to think that through a bit but I
think you could probably bundle up 90% of the work into one place and
get it over with.
On Dec 13, 2004, at 10:53 AM, Benjohn wrote:
>
> On 13 Dec 2004, at 16:40, John Stiles wrote:
>
>> This isn't possible.
>
> Oh blast. Thank you for confirming that.
>
>> As a general rule of thumb, if you didn't compile it yourself, you
>> probably can't throw through it.
>> Try catching all throws at as low a level as possible without going
>> back into AppKit, like this:
>>
>> Our c++ code - throw occurs here.
>> Our c++ code
>> Our c++ code - try catching here
>> App Kit / Foundation
>> App Kit / Foundation
>> App Kit / Foundation
>> App Kit / Foundation
>> Our handler
>> App Kit / Foundation
>> App Kit / Foundation
>> Root of the stack
>>
>> And then post some sort of notification so the run-loop can know
>> what's going on.
>
> *nods*
>
> Can you see a nice way of achieving this, that avoids adding try catch
> blocks in lots of places (I imagine there are many points where our
> code is invoked by a caller that doesn't allow exceptions to pass
> through it)? As an example, perhaps we could patch the objective c
> message dispatcher to ensure calls to our code are wrapped in a try
> catch block.
>
> Cheers,
> Benjohn
>
DATE : Mon Dec 13 20:38:57 2004
I'd shy away from doing anything to the message dispatch machinery.
It's not something you want to fiddle with.
OTOH, I could imagine a nice template or something that would
automatically build up the catch machinery around your function with
only a little bit of effort. I'd have to think that through a bit but I
think you could probably bundle up 90% of the work into one place and
get it over with.
On Dec 13, 2004, at 10:53 AM, Benjohn wrote:
>
> On 13 Dec 2004, at 16:40, John Stiles wrote:
>
>> This isn't possible.
>
> Oh blast. Thank you for confirming that.
>
>> As a general rule of thumb, if you didn't compile it yourself, you
>> probably can't throw through it.
>> Try catching all throws at as low a level as possible without going
>> back into AppKit, like this:
>>
>> Our c++ code - throw occurs here.
>> Our c++ code
>> Our c++ code - try catching here
>> App Kit / Foundation
>> App Kit / Foundation
>> App Kit / Foundation
>> App Kit / Foundation
>> Our handler
>> App Kit / Foundation
>> App Kit / Foundation
>> Root of the stack
>>
>> And then post some sort of notification so the run-loop can know
>> what's going on.
>
> *nods*
>
> Can you see a nice way of achieving this, that avoids adding try catch
> blocks in lots of places (I imagine there are many points where our
> code is invoked by a caller that doesn't allow exceptions to pass
> through it)? As an example, perhaps we could patch the objective c
> message dispatcher to ensure calls to our code are wrapped in a try
> catch block.
>
> Cheers,
> Benjohn
>
| Related mails | Author | Date |
|---|---|---|
| Benjohn | Dec 13, 17:09 | |
| John Stiles | Dec 13, 17:40 | |
| Michael Crawford | Dec 13, 19:24 | |
| Michael Crawford | Dec 13, 19:24 | |
| Benjohn | Dec 13, 19:53 | |
| John Stiles | Dec 13, 20:38 | |
| Keith Ray | Dec 13, 20:39 | |
| Martin | Dec 14, 01:29 | |
| Benjohn | Dec 14, 14:34 |






Cocoa mail archive

