     START-INFO-DIR-ENTRY
     * Objective-C: (objective-c).           The GNU Objective-C Language Manual
     END-INFO-DIR-ENTRY

Copyright © 1994 Andrew Kachites McCallum and Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.

Main Menu
*********

This is the manual for the GNU Objective-C language.

Introduction
************

This manual describes the GNU Objective-C language.  It is assumed that the reader is already familiar with ANSI C.

Overview
========

Objective-C is an object-oriented computer programming language.  It is a superset of ANSI C and provides classes and message passing similar to Smalltalk.  (xxx Lifted from FAQ.  General question: Should I lift from the Objc FAQ?  Is there a problem with this?  If in doubt, I'll write it all myself.)

Caveats
=======

This manual is pre-alpha.  I am now trying to determine the organization of manual.  Afterward, sections will be filled in with text.

If you have suggestions for additional topics or organizational changes, please email them to mccallum@cs.rochester.edu.

Conventions
===========

Acknowledgements
================

Objects, Messages and Classes
*****************************

Object-oriented programming made up of objects, the messages they can receive and the classes that specify how objects are related.

Objects Encapsulate Data and Operations
=======================================

Procedures and data in a bundle.  Abstraction.

Messages Request Operations
===========================

     [RECEIVER MESSAGE];

Messages with arguments. Return types. Argument types. Messages to nil.

Classes Define Objects
======================

Inheritance of methods and instance variables. Overriding methods. Syntax of @interface, @implementation. Messages to super. Creating and freeing instances.

Inheritance of Subclasses
=========================

Programming Techniques and Conventions
**************************************

Overriding Methods
==================

Abstract Superclasses
=====================

Returning self
==============

...more here...
===============

Advanced Features
*****************

Runtime Message Variation
=========================

Describe -perform: and friends.

Forwarding a Message
====================

Describe -forward:: and -performv::.

Adding Methods to a Class
=========================

Categories. You can use this feature to add new methods to a class, but not to change methods that have already been defined in the class implementation. You can't add new instance variables (although I should include a footnote that shows the hack for getting around this).

Posing as a Superclass
======================

Describe poseAs:. Changing Behavior of Inherited Methods. Substituting a your new class for some old class. You can use this to override methods that have already been defined in the implementation of the old class.

Use subclassing to override method behavior in new classes you write. Use posing to override method behavior in preexisting subclasses of the posed class.

Defining a Message Protocol
===========================

Class Initialization
====================

Describe the +initialize method.

Encoding Types
==============

Obtaining the Structure of an Object
====================================

Archiving Objects to a Stream
=============================

...potential for more here...
=============================

Builtin Classes
***************

The Object Class
================

Creating, Copying and Freeing
-----------------------------

 -- Method on Object: +alloc

 -- Method on Object: +new

 -- Method on Object: -init

 -- Method on Object: -shallowCopy

 -- Method on Object: -deepCopy

 -- Method on Object: -deepen

 -- Method on Object: -copy

 -- Method on Object: -free

Identifying the Class
---------------------

 -- Method on Object: (Class*) -class

 -- Method on Object: (const char *) -name

Identifying and Comparing the Instance
--------------------------------------

 -- Method on Object: -self

 -- Method on Object: (int) -hash

 -- Method on Object: (BOOL) -isEqual: ANOBJECT

 -- Method on Object: (int) -compare ANOBJECT

Determining Object Type
-----------------------

 -- Method on Object: (BOOL) -isMetaClass

 -- Method on Object: (BOOL) -isClass

 -- Method on Object: (BOOL) -isInstance

Determining Inheritance Relations
---------------------------------

 -- Method on Object: (BOOL) -isKindOf: (Class*)ACLASSOBJ

 -- Method on Object: (BOOL) -isKindOfClassNamed: (const char *)ACLASSNAME

 -- Method on Object: (BOOL) -isMemberOf: (Class*)ACLASSOBJ

 -- Method on Object: (BOOL) -isMemberOfClassNamed: (const char *)ACLASSNAME

Determining Messages Understood
-------------------------------

 -- Method on Object: (BOOL) -instancesRespondTo: (SEL)ASEL

 -- Method on Object: (BOOL) -respondsTo: (SEL)ASEL

 -- Method on Object: (BOOL) -conformsTo: (Protocol*)APROTOCOLOBJ

Method Lookup
-------------

Sending Messages Determined at Runtime
--------------------------------------

Forwarding
----------

Posing
------

Enforcing Intentions
--------------------

Announcing Errors
-----------------

Archiving
---------

 -- Method on Object: (int) +version
     <<Undocumented>>

 -- Method on Object: +setVersion: (int)AVERSION
     <<Undocumented>>

 -- Method on Object: (int) +streamVersion: (TypedStream*)ASTREAM
     <<Undocumented>>

 -- Method on Object: -write: (TypedStream*)ASTREAM
     <<Undocumented>>  Returns self.

 -- Method on Object: -read: (TypedStream*)ASTREAM
     <<Undocumented>>  Returns self.

The Protocol Class
==================

 -- Method on Protocol: (const char *) -name

 -- Method on Protocol: (BOOL) -conformsTo: (Protocol*)APROTOCOLOBJ

 -- Method on Protocol: (struct objc_method_description *) -descriptionForInstanceMethod: (SEL)ASEL

 -- Method on Protocol: (struct objc_method_description *) -descriptionForClassMethod: (SEL)ASEL

Objective-C History and Comparisons
***********************************

History of Objective-C
======================

Smalltalk and Objective-C
=========================

Difference between Objective-C and C++
======================================

Difference between GNU Objective-C and others
=============================================

Runtime Internals
*****************

Some notes on topics to be covered: Data structures: Symtab, Module, IvarList, MethodList, Category. Info bits. Runtime class lookup. Ivar lookup. Method lookup. version number. IMP. objc_class. arglist_t. sarray.

Method Lookup and Selectors
===========================

objc_msg_lookup. message to self and super.

 -- Data Type: IMP
     The IMP data type is a pointer to the function implementing an Objective-C method.

Runtime Initialization
======================

Memory Management
=================

class_create_instance, object_dispose, object_copy...

For instance, Object's -alloc method is implemented like this:

     + alloc
     {
       return class_create_instance(self);
     }

Metaclasses
===========

Move this to "Advanced Features"?  I'm not sure we want to talk about it as an implementation detail.

Archiving and Typed Streams
===========================

Internal Hash Tables
====================

Hacking for Efficiency
**********************

Getting the Address of a Method
===============================

Getting the Address of an Instance Variable
===========================================

Debugging Objective-C
*********************

Language Summary
****************

Directives
==========

  * @defs

  * @encode

  * @end

  * @implementation

  * @interface

  * @protocol

  * @public

  * @selector

Declaring Methods
=================

Difference between -,+.  Return types of methods.  Argument types of methods.

Types and Keywords
==================

BOOL, Class, id, IMP, SEL, STR.

nil, Nil.

Formal Grammar of Objective-C
=============================