help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] Correct way to throw exceptions/errors from C to ST


From: Roland Plüss
Subject: Re: [Help-smalltalk] Correct way to throw exceptions/errors from C to ST
Date: Sun, 12 Apr 2015 16:19:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 04/08/2015 01:45 PM, Roland Plüss wrote:
> And as far as I know I can't include any code into a <primitive>
> declared method.
>
> I once did the trick with errno type error handling in a module I made
> for Smalltalk but it's cumbersome to use and error prone.
>> <primitive> will execute the Smalltalk code in case the primtive
>> failed.  E.g. for the Array
>>
>> kernel/Array.st-    at: anIndex ifAbsent: aBlock [
>> kernel/Array.st-        "Answer the index-th indexed instance variable of 
>> the receiver"
>> kernel/Array.st-
>> kernel/Array.st-        <category: 'built ins'>
>> kernel/Array.st:        <primitive: VMpr_Object_basicAt>
>> kernel/Array.st-        ^self checkIndexableBounds: anIndex ifAbsent: aBlock
>> kernel/Array.st-    ]
>>
> When exactly does a primitive fail and how can I trigger this from
> inside a cCall? This might actually be abused for a little trick if
> working right.
>
Maybe the question got lost in the mailing list? What does make a
primitive fail as seen from the Smalltalk VM?

-- 
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- As well as various Blender export scripts und game tools

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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