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: Tue, 07 Apr 2015 18:24:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 04/06/2015 06:45 PM, Holger Hans Peter Freyther wrote:
> On Sun, Apr 05, 2015 at 05:47:29PM +0200, Roland Plüss wrote:
>
>> What you mean with "C-style error"? A C++ exception (that doesn't work
>> it looks like)? The cCall is of void return type so I can't return
>> anything. And smalltalk side can't check the arguments as the
>> information required to perform the checks is sometimes located deep
>> inside the engine code base.
> "C-style" error.. a non zero return code and maybe setting a
> variable with the semantic of errno. The return type of "void"
> is your decision? Can't you return something to indicate success
> or failure?
I sure can decide the return type. I just considered it quite quick and
easy if I could return an #int if I link to a function actually
returning an integer. I certainly could return nil but then I have no
idea what error really happened nor can I properly catch it (well...
besides ifNotNil: ). Since Smalltalk has already an exception/error
system why not using it? I don't like wrangling a language unless
there's no other choice.

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.

-- 
Mit freundlichen Grüssen
Plüss Roland

Leader und 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 )
- Sowie verschiedene Blender Export-Skripts und Game-Tools

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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