Contexts and exception handlers
Adrian Lienhard
adi at netstyle.ch
Wed Aug 2 19:20:06 UTC 2006
Hi David,
It's not the case that the exception handler is not active but rather
that the context is not on the stack. It looks like the context is
only used in the compiler to allow you to access its temps (and
args). But the method itself is executed as a normal send without any
mangling of the stack. If you put a halt in the evaluated code, you
don't find the block context on the stack. Of course, what works is
to put the evaluation of the code within the block, but that's maybe
not what you wanted. To make the tools aware of dynamic variables
would indeed be useful (e.g., for the current Seaside session).
Cheers,
Adrian
On Aug 2, 2006, at 18:42 , David Shaffer wrote:
> When saving a context and using it in
> Compiler>>evaluate:in:to:notifying:ifFail:logged: it doesn't appear
> that
> exception handlers are active. Here's a test case which
> demonstrates my
> expectations (which are clearly flawed). Can anyone help me
> understand
> why this notification isn't caught?
>
> BTW, I'm simply trying to figure out how to get the Inspector,
> Debugger,
> ObjectExplorer etc to be able to access "dynamic variables" which
> existed in the context in which the tool was activated.
>
> David
>
> 'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 2
> August 2006 at 12:34:47 pm'!
> TestCase subclass: #SCContextTest
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'SCContextAwareInspector'!
>
> !SCContextTest methodsFor: 'running' stamp: 'cds 8/2/2006 12:33'!
> testNotificationCaught
> |ctxt notified|
> notified := false.
> [ctxt := thisContext] on: SCTestNotification do: [notified := true].
> self deny: notified.
> Compiler new evaluate: 'SCTestNotification signal' in: ctxt to:
> self notifying: nil ifFail: [^nil] logged: false.
> self assert: notified! !
> 'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 2
> August 2006 at 12:34:49 pm'!
> Notification subclass: #SCTestNotification
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'SCContextAwareInspector'!
>
More information about the Squeak-dev
mailing list
|