FFI and apicall/cdecl type

ncellier at ifrance.com ncellier at ifrance.com
Wed Jul 19 10:06:12 UTC 2006


I agree, C-Style was not pejorative here. It is just a style consisting in checking returned value of functions (messages). Very simple in this case, and i'am OK with that.

You answer the question which type has this name (nil means none), and testing isNil, you answer the question does such a type exist. This is something equivalent to Dictionary access like:
    ExternalType at: name ifAbsent: [nil].

And yes, nil is much cleaner than C implicit encoding (0, -1, 1 all can mean true, false, nil, failure, depending on the function).

Nicolas

Andreas Raab:
> 
> Nicolas wrote:
> >     You must understand that returning nil is a simple way to indicate a
> >     failure (a kind of C-style programming).
> 
> Absolutely not. It is a query about "is there a type of that name"? 
> Returning nil does not indicate failure - it indicates that no type by 
> that name exist. Whether that denotes "failure" or a perfectly legal 
> response is in the eye of the beholder (the sender of the message). As 
> an example for this, look at the senders of #atomicTypeNamed: and notice 
> how the response is used in a variety of ways none of which denotes 
> "failure" in any way or shape.
> 
> Cheers,
>    - Andreas
> 
> 


________________________________________________________________________
iFRANCE, exprimez-vous !
http://web.ifrance.com


More information about the Squeak-dev mailing list