Re: Correct way to throw exceptions/errors from C to ST

Roland Plüss <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

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

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUqfvMACgkQjKGu9ysRWfqNcgCfamQiMC2I/80CDN87Cv+V9zur
xy8An2tI9VGrEF6O+y61so8/sfrwRGQK
=rAQQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.