|
|
GNU Objective C notes
|
GNU Objective C notes
|
*********************
|
*********************
|
|
|
This document is to explain what has been done, and a little about how
|
This document is to explain what has been done, and a little about how
|
specific features differ from other implementations. The runtime has
|
specific features differ from other implementations. The runtime has
|
been completely rewritten in gcc 2.4. The earlier runtime had several
|
been completely rewritten in gcc 2.4. The earlier runtime had several
|
severe bugs and was rather incomplete. The compiler has had several
|
severe bugs and was rather incomplete. The compiler has had several
|
new features added as well.
|
new features added as well.
|
|
|
This is not documentation for Objective C, it is usable to someone
|
This is not documentation for Objective C, it is usable to someone
|
who knows Objective C from somewhere else.
|
who knows Objective C from somewhere else.
|
|
|
|
|
Runtime API functions
|
Runtime API functions
|
=====================
|
=====================
|
|
|
The runtime is modeled after the NeXT Objective C runtime. That is,
|
The runtime is modeled after the NeXT Objective C runtime. That is,
|
most functions have semantics as it is known from the NeXT. The
|
most functions have semantics as it is known from the NeXT. The
|
names, however, have changed. All runtime API functions have names
|
names, however, have changed. All runtime API functions have names
|
of lowercase letters and underscores as opposed to the
|
of lowercase letters and underscores as opposed to the
|
`traditional' mixed case names.
|
`traditional' mixed case names.
|
The runtime api functions are not documented as of now.
|
The runtime api functions are not documented as of now.
|
Someone offered to write it, and did it, but we were not allowed to
|
Someone offered to write it, and did it, but we were not allowed to
|
use it by his university (Very sad story). We have started writing
|
use it by his university (Very sad story). We have started writing
|
the documentation over again. This will be announced in appropriate
|
the documentation over again. This will be announced in appropriate
|
places when it becomes available.
|
places when it becomes available.
|
|
|
|
|
Protocols
|
Protocols
|
=========
|
=========
|
|
|
Protocols are now fully supported. The semantics is exactly as on the
|
Protocols are now fully supported. The semantics is exactly as on the
|
NeXT. There is a flag to specify how protocols should be typechecked
|
NeXT. There is a flag to specify how protocols should be typechecked
|
when adopted to classes. The normal typechecker requires that all
|
when adopted to classes. The normal typechecker requires that all
|
methods in a given protocol must be implemented in the class that
|
methods in a given protocol must be implemented in the class that
|
adopts it -- it is not enough to inherit them. The flag
|
adopts it -- it is not enough to inherit them. The flag
|
`-Wno-protocol' causes it to allow inherited methods, while
|
`-Wno-protocol' causes it to allow inherited methods, while
|
`-Wprotocols' is the default which requires them defined.
|
`-Wprotocols' is the default which requires them defined.
|
|
|
|
|
+initialize
|
+initialize
|
===========
|
===========
|
|
|
This method, if defined, is called before any other instance or class
|
This method, if defined, is called before any other instance or class
|
methods of that particular class. This method is not inherited, and
|
methods of that particular class. This method is not inherited, and
|
is thus not called as initializer for a subclass that doesn't define
|
is thus not called as initializer for a subclass that doesn't define
|
it itself. Thus, each +initialize method is called exactly once (or
|
it itself. Thus, each +initialize method is called exactly once (or
|
never if no methods of that particular class is never called).
|
never if no methods of that particular class is never called).
|
Besides this, it is allowed to have several +initialize methods, one
|
Besides this, it is allowed to have several +initialize methods, one
|
for each category. The order in which these (multiple methods) are
|
for each category. The order in which these (multiple methods) are
|
called is not well defined. I am not completely certain what the
|
called is not well defined. I am not completely certain what the
|
semantics of this method is for other implementations, but this is
|
semantics of this method is for other implementations, but this is
|
how it works for GNU Objective C.
|
how it works for GNU Objective C.
|
|
|
|
|
Passivation/Activation/Typedstreams
|
Passivation/Activation/Typedstreams
|
===================================
|
===================================
|
|
|
This is supported in the style of NeXT TypedStream's. Consult the
|
This is supported in the style of NeXT TypedStream's. Consult the
|
headerfile Typedstreams.h for api functions. I (Kresten) have
|
headerfile Typedstreams.h for api functions. I (Kresten) have
|
rewritten it in Objective C, but this implementation is not part of
|
rewritten it in Objective C, but this implementation is not part of
|
2.4, it is available from the GNU Objective C prerelease archive.
|
2.4, it is available from the GNU Objective C prerelease archive.
|
There is one difference worth noting concerning objects stored with
|
There is one difference worth noting concerning objects stored with
|
objc_write_object_reference (aka NXWriteObjectReference). When these
|
objc_write_object_reference (aka NXWriteObjectReference). When these
|
are read back in, their object is not guaranteed to be available until
|
are read back in, their object is not guaranteed to be available until
|
the `-awake' method is called in the object that requests that object.
|
the `-awake' method is called in the object that requests that object.
|
To objc_read_object you must pass a pointer to an id, which is valid
|
To objc_read_object you must pass a pointer to an id, which is valid
|
after exit from the function calling it (like e.g. an instance
|
after exit from the function calling it (like e.g. an instance
|
variable). In general, you should not use objects read in until the
|
variable). In general, you should not use objects read in until the
|
-awake method is called.
|
-awake method is called.
|
|
|
|
|
Acknowledgements
|
Acknowledgements
|
================
|
================
|
|
|
The GNU Objective C team: Geoffrey Knauth (manager),
|
The GNU Objective C team: Geoffrey Knauth (manager),
|
Tom Wood (compiler) and Kresten Krab Thorup
|
Tom Wood (compiler) and Kresten Krab Thorup
|
(runtime) would like to thank a some people for
|
(runtime) would like to thank a some people for
|
participating in the development of the present GNU Objective C.
|
participating in the development of the present GNU Objective C.
|
|
|
Paul Burchard and Andrew McCallum
|
Paul Burchard and Andrew McCallum
|
has been very helpful debugging the
|
has been very helpful debugging the
|
runtime. Eric Herring has been very helpful
|
runtime. Eric Herring has been very helpful
|
cleaning up after the documentation-copyright disaster and is now
|
cleaning up after the documentation-copyright disaster and is now
|
helping with the new documentation.
|
helping with the new documentation.
|
|
|
Steve Naroff and Richard Stallman
|
Steve Naroff and Richard Stallman
|
has been very helpful with implementation details
|
has been very helpful with implementation details
|
in the compiler.
|
in the compiler.
|
|
|
|
|
Bug Reports
|
Bug Reports
|
===========
|
===========
|
|
|
Please read the section `Submitting Bugreports' of the gcc manual
|
Please read the section `Submitting Bugreports' of the gcc manual
|
before you submit any bugs.
|
before you submit any bugs.
|
|
|