help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [ANN] Mirrors for GST


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [ANN] Mirrors for GST
Date: Tue, 28 Feb 2012 15:22:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]