Go to the first, previous, next, last section, table of contents.
-
Objective-C source files have file extension `.m'. Both
C-compatibility header files and class declaration files have extension
`.h'.
-
Objective-C class names begin with capital letters. Multi-word class
names capitalize each word, with no underscore separation.
-
Include files that define Objective-C classes begin with capital letters
(as do the names of the classes themselves).
-
All protocols end with
ing
. All collection protocols end with
Collecting
. All collection abtract superclasses (classes which
are not usable without subclassing) end with Collection
.
-
Include files that supply function prototypes for other C
functions are all lower case.
-
Instance variables begin with an underscore, are all lower case, and
have underscores separating their component words. The leading
underscore distinguishes them from local varibles defined inside
methods.
-
All include files define a preprocessor variable __X_h_INCLUDE_GNU,
where X is the name of the file, and conditionally compile only if this
has not been already defined.
-
The following macros and variables make the relevant version numbers
available:
- Macro: COLL_VERSION
-
The version number of the collection library.
Declared in `coll/collstd.h'
- Macro: COLL_GCC_VERSION
-
The version number of the compiler used to compile the collection
library.
Declared in `coll/collstd.h'
- Variable: char[] coll_version
-
A string containing the version number of the collection library.
Declared in `coll/collstd.h'
- Variable: char[] coll_gcc_version
-
A string containing the version number of the compiler used to compile
the collection library.
Declared in `coll/collstd.h'
Objective-C is not Smalltalk. Differences that matter to the
Collection heirarchy:
-
There can be only one set of argument types with each selector.
(For instance in Objective-C we can't have "-(double)data" and
"-(char)data". I can't stand it when some library that I'm forced to
load already defines a selector that I want to use with different
types.) This isn't an issue in Smalltalk because everything is an
object.
I make the Collection method names a little more descriptive, while
keeping them close to Smalltalk. (For instance I think there is a
good reason for using "-addObject:" instead of "-add:")
-
We will want collections of int's, float's, and other non-Objects.
Using Objective C wrappers around these C primitive types (i.e.
Integer and Float objects) is not an efficient enough option for all
cases.
We could create two parallel heirarchies, one for Objects and one
for elements passed as void*, but since so much of the functionality
overlaps, I have merged them, and it doesn't actually look all that
bad.
-
Objective C doesn't have Smalltalk Blocks.
Passing pointers to functions is a reasonable substitute. This is made
easier with gcc's nested functions and the LAMBDA() macro defined in
coll/collstd.h.
-
Smalltalk does automatic garbage collection; Objective C doesn't.
I think it should be made obvious which methods allocate a new
object. Hence "-shallowCopyAs:[Bag class]" instead of
"as:[Bag class]".
-
We have usable Collection classes (Set, Bag, Array, etc) with
functionality matching Smalltalk's objects, but there are good
reasons for not having the abstract superclass structure match
Smalltalk exactly.
<<This section unfinished.>>
Go to the first, previous, next, last section, table of contents.