FFI fix, new construct

Brian Rice water at tunes.org
Fri Feb 10 11:37:23 PST 2006


Hello,

Thanks to some investigation via a contributor, I've figured out the  
right fix for unsuccessful attempts to load an ExternalLibrary. Also  
in that line of work, I noticed that unlessCompletes: and  
ifCompletes: would be best implemented with a single construct, so  
there is now:

m@(Method traits) ifCompletes: successBlock otherwise: errorBlock
"Executes the first method, and then executes either the successBlock  
or the
errorBlock depending on whether there is a non-local exit that  
prevents the
first from completing normally."
[| exitedNormally result |
   exitedNormally: False.
   [result: m do. exitedNormally: True. result]
     ensure: [exitedNormally ifTrue: [successBlock do] ifFalse:  
[errorBlock do]]
].

which I may rename as ifCompletes:ifFails: but that is not hard to  
change at all. The important thing is that this nicely mirrors  
ifTrue:ifFalse: and both ifCompletes: and unlessCompletes: are now  
implemented in terms of it.

This is bootstrapped into the alpha images and tarball. Enjoy!

--
-Brian
http://tunes.org/~water/brice.vcf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20060210/82e6d1e8/PGP.pgp


More information about the Slate mailing list