|
From: | Gwenaël Casaccio |
Subject: | Re: [Help-smalltalk] [ANN] Mirrors for GST |
Date: | Wed, 29 Feb 2012 11:13:27 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
On 28/02/2012 15:22, Paolo Bonzini wrote:
Il 28/02/2012 15:00, Gwenaël Casaccio ha scritto:I've made a MirrorPrimitive and two pragmas; the first pragma calls the primitive but the second has an extra argument an error block (i.e. vmPrimitive for: ... at: ifFailed: []) Thus no exceptions are raised (and thus no possible leaked vmPrimitves objects). The primitive number is added at the end by the pragma. I've added the compiled method as an extra parameter to the execute_primitive function. classFor: anObject [ <mirrorPrimtive: VMpr_Object_Class> ] for: anObject at: anIndex ifFailed: aBlock [ <mirrorPrimtiveWithBlock: VMpr_Object_basicAt> ^aBlock value ]Do you need the second? Perhaps you can just call ^self primitiveFailed, and catch the exception in the caller. Mirror primitives that can fail shouldn't be on a fast path, should they? Otherwise looks good. Paolo
Hello,about the exceptions. frankly I'm not sure about mirrors errors handling: I like to force the user to handle errors (for Mirrors) but there is one exception #dnu: errors (returning ^ self is too "dangerous" it will be a pain to debug the application). Thus if I raise an exception specially with a mirror an object could capture exception and the mirror and you know the next. In fact I would like to understand a bit more what is the best approach maybe "safer" exceptions are better, an object could capture them but cannot break the encapsulation of the exception.
And since I'm talking about exceptions what about a process that handle exceptions like Erlang : It will capture all the exception of the running image could handle some cases, and in the worst case could restart the service (the image with a kind of OSProcess) - just a vague idea
Cheers, Gwen
[Prev in Thread] | Current Thread | [Next in Thread] |