Hi,

I post this to the list because I think it may be a good idea for  
documentation reasons.

In the past days I've been thinking about how the whole stack- 
unwinding code can be tested, like -[NSObject release]ing objects when  
exceptions or non-local returns fly by over the stack locations of  
their references. The more I think about it, the more I come to the  
conclusion that a formal model of it may be a good idea.

An interesting thing I noticed was: Exception handling mechanisms can  
be implemented using non-local returns. Non-local returns can be  
implemented using an existing exception handling mechanism.

Because of that observation, I started to wonder how well the LK non- 
local returns play together with the stack unwinding done in Objective- 
C exception handling, particularly in cases like these:

test [
        [
                self mayThrowException
        ] onException: 'NSSurpriseException' do: [
                ^ false "Non-local return!"
        ]
        ^ true
]

The point here is this: Objective-C exception handling requires you to  
use NS_VALUERETURN inside of Try- and/or Catch-Blocks. The  
onException:do: implementation does exactly that with the handler  
block's return value. However, by using non-local returns, this can be  
circumvented.

I'd like to write a test to check that, but I currently really don't  
know how to check for incorrect stack unwinding. Does anyone of you  
know this?

Best regards,
Günther


_______________________________________________
Etoile-dev mailing list
Etoile-dev@gna.org
https://mail.gna.org/listinfo/etoile-dev

Reply via email to