5.11 Cocoa Foundation
The ffi/unsafe/nsalloc and
ffi/unsafe/nsstring libraries provide basic
facilities for working with Cocoa and/or Mac OS X Foundation
libraries (usually along with ffi/objc).
A type that converts between Racket strings and
values. That is, use _NSString
as a type for a foreign-function
argument or result.
The _NSString conversion keeps a weak mapping from Racket
strings to converted strings, so that converting the same string (in
the equal? sense) multiple times may avoid allocating
multiple NSString objects.
5.11.2 Allocation Pools
Calling any Foundation API that
allocates requires an NSAutoreleasePool
library provides a function and
shorthand syntactic form for setting up such a context. (The
type creates an autorelease pool implicitly while
converting from/to a Racket string, however.)
Calls thunk in atomic mode and with a fresh
NSAutoreleasePool that is released after thunk