chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] objc egg v0.4


From: Zbigniew
Subject: [Chicken-users] objc egg v0.4
Date: Sat, 21 Jan 2006 02:55:04 -0600

I've updated the objc egg to v0.4 in the SVN repository.  An eggdoc is
forthcoming, hopefully very soon.  In the meantime, here's a summary
of changes:

- Class proxies.  The objc:class wrapper for each class is now unique
(rather than simply containing a pointer) and contains metadata useful
to the bridge.  This makes the following features possible:
    - Instance variable memory management.  ID (instance) types are
properly retained when using objc:ivar-set!, and any old value
released.  Dealloc now releases these objects.
    - Interface Builder outlets.  Specifying the outlet: keyword
negates memory management.
    - Instance variables can hold scheme types.  From within scheme,
any access to variables marked with keyword slot: are converted to and
from scheme objects.  For example, you can store a vector or closure
in an instance variable.
    - Callback optimization in @ invocation.  The current heuristic is
very simple: any class with a scheme implemenation in its hierarchy
uses a safe call; pure Objective C classes use a normal call.  This is
a big win for pure Objective C class or instance calls, a tie for
Scheme class calls, and a 10% penalty for Scheme instance calls.  This
can be disabled with (objc:optimize-callbacks #f).

Other changes:

- (@ ...) invocation syntax.  I have come to vastly prefer this style
as opposed to @[...] because it is consistent with scheme function
calls, and it nests better.  @[...] is still available.

- Hyphenated selectors.  For example, dictionaryWithContentsOfFile:
can now be written as dictionary-with-contents-of-file: in any
invocation.  The same is true for class method definitions: (- VOID
awake-from-nib ...) is now accepted.

- (objc:wrap x) and (objc:unwrap x) wrap and unwrap a scheme object
inside an Objective C object, a Scheme_Object_Wrapper.  This allows
you to pass a scheme object such as a vector or closure into or out of
an Objective C method implemented in Scheme.
    -- Note: this is similar to how the automatic ivar scheme types
work, but those are implemented more efficiently as bare pointers to
GC roots.  If you specify the wrapper: type qualifier for an ivar, it
will use objc:wrap/unwrap instead; this will incur more overhead with
no real benefit.

Any old code (I know I am the only one writing any ;) should now use
the outlet: qualifier for any Interface Builder outlets.  This is the
only required change, and in fact your code will probably even work
without it.

I'll post some thoughts on instance proxies later, a topic which has
yet to present a clear solution to me.




reply via email to

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