<s>
Objective-C	B-Language
is	O
a	O
high-level	B-Language
general-purpose	B-Language
,	O
object-oriented	B-Language
programming	I-Language
language	I-Language
that	O
adds	O
Smalltalk-style	O
messaging	B-Architecture
to	O
the	O
C	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Originally	O
developed	O
by	O
Brad	O
Cox	O
and	O
Tom	O
Love	O
in	O
the	O
early	O
1980s	O
,	O
it	O
was	O
selected	O
by	O
NeXT	O
for	O
its	O
NeXTSTEP	B-Application
operating	O
system	O
.	O
</s>
<s>
Due	O
to	O
Apple	B-Operating_System
macOS	I-Operating_System
’s	O
direct	O
lineage	O
from	O
NeXTSTEP	B-Application
,	O
Objective-C	B-Language
was	O
the	O
standard	O
programming	O
language	O
used	O
,	O
supported	O
,	O
and	O
promoted	O
by	O
Apple	O
for	O
developing	O
macOS	B-Operating_System
and	O
iOS	B-Application
applications	O
(	O
via	O
their	O
respective	O
APIs	B-Application
,	O
Cocoa	B-Operating_System
and	O
Cocoa	B-Operating_System
Touch	I-Operating_System
)	O
until	O
the	O
introduction	O
of	O
the	O
Swift	B-Application
programming	I-Application
language	I-Application
in	O
2014	O
.	O
</s>
<s>
Objective-C	B-Language
programs	O
developed	O
for	O
non-Apple	O
operating	O
systems	O
or	O
that	O
are	O
not	O
dependent	O
on	O
Apple	O
's	O
APIs	B-Application
may	O
also	O
be	O
compiled	O
for	O
any	O
platform	B-Device
supported	O
by	O
GNU	B-Application
GCC	I-Application
or	O
LLVM/Clang	O
.	O
</s>
<s>
Objective-C	B-Language
source	O
code	O
'	O
messaging/implementation	O
'	O
program	O
files	O
usually	O
have	O
filename	O
extensions	O
,	O
while	O
Objective-C	B-Language
'	O
header/interface	O
'	O
files	O
have	O
extensions	O
,	O
the	O
same	O
as	O
C	B-Language
header	I-Language
files	I-Language
.	O
</s>
<s>
Objective-C	B-Language
++	O
files	O
are	O
denoted	O
with	O
a	O
file	O
extension	O
.	O
</s>
<s>
Objective-C	B-Language
was	O
created	O
primarily	O
by	O
Brad	O
Cox	O
and	O
Tom	O
Love	O
in	O
the	O
early	O
1980s	O
at	O
their	O
company	O
Productivity	O
Products	O
International	O
(	O
PPI	O
)	O
.	O
</s>
<s>
Leading	O
up	O
to	O
the	O
creation	O
of	O
their	O
company	O
,	O
both	O
had	O
been	O
introduced	O
to	O
Smalltalk	B-Application
while	O
at	O
ITT	O
Corporation	O
's	O
Programming	O
Technology	O
Center	O
in	O
1981	O
.	O
</s>
<s>
The	O
earliest	O
work	O
on	O
Objective-C	B-Language
traces	O
back	O
to	O
around	O
that	O
time	O
.	O
</s>
<s>
Cox	O
was	O
intrigued	O
by	O
problems	O
of	O
true	O
reusability	O
in	O
software	B-General_Concept
design	I-General_Concept
and	O
programming	O
.	O
</s>
<s>
He	O
realized	O
that	O
a	O
language	O
like	O
Smalltalk	B-Application
would	O
be	O
invaluable	O
in	O
building	O
development	O
environments	O
for	O
system	O
developers	O
at	O
ITT	O
.	O
</s>
<s>
However	O
,	O
he	O
and	O
Tom	O
Love	O
also	O
recognized	O
that	O
backward	B-General_Concept
compatibility	I-General_Concept
with	O
C	B-Language
was	O
critically	O
important	O
in	O
ITT	O
's	O
telecom	O
engineering	O
milieu	O
.	O
</s>
<s>
Cox	O
began	O
writing	O
a	O
pre-processor	O
for	O
C	B-Language
to	O
add	O
some	O
of	O
the	O
abilities	O
of	O
Smalltalk	B-Application
.	O
</s>
<s>
He	O
soon	O
had	O
a	O
working	O
implementation	O
of	O
an	O
object-oriented	B-Language
extension	O
to	O
the	O
C	B-Language
language	I-Language
,	O
which	O
he	O
called	O
"	O
OOPC	O
"	O
for	O
Object-Oriented	B-Language
Pre-Compiler	O
.	O
</s>
<s>
Love	O
was	O
hired	O
by	O
Schlumberger	O
Research	O
in	O
1982	O
and	O
had	O
the	O
opportunity	O
to	O
acquire	O
the	O
first	O
commercial	O
copy	O
of	O
Smalltalk-80	B-Application
,	O
which	O
further	O
influenced	O
the	O
development	O
of	O
their	O
brainchild	O
.	O
</s>
<s>
Specifically	O
,	O
they	O
needed	O
to	O
support	O
objects	O
in	O
a	O
flexible	O
manner	O
,	O
come	O
supplied	O
with	O
a	O
usable	O
set	O
of	O
libraries	O
,	O
and	O
allow	O
for	O
the	O
code	O
(	O
and	O
any	O
resources	O
needed	O
by	O
the	O
code	O
)	O
to	O
be	O
bundled	O
into	O
one	O
cross-platform	B-Operating_System
format	O
.	O
</s>
<s>
Love	O
and	O
Cox	O
eventually	O
formed	O
PPI	O
to	O
commercialize	O
their	O
product	O
,	O
which	O
coupled	O
an	O
Objective-C	B-Language
compiler	O
with	O
class	O
libraries	O
.	O
</s>
<s>
In	O
1986	O
,	O
Cox	O
published	O
the	O
main	O
description	O
of	O
Objective-C	B-Language
in	O
its	O
original	O
form	O
in	O
the	O
book	O
Object-Oriented	B-Application
Programming	I-Application
,	O
An	O
Evolutionary	O
Approach	O
.	O
</s>
<s>
Although	O
he	O
was	O
careful	O
to	O
point	O
out	O
that	O
there	O
is	O
more	O
to	O
the	O
problem	O
of	O
reusability	O
than	O
just	O
what	O
Objective-C	B-Language
provides	O
,	O
the	O
language	O
often	O
found	O
itself	O
compared	O
feature	O
for	O
feature	O
with	O
other	O
languages	O
.	O
</s>
<s>
In	O
1988	O
,	O
NeXT	O
licensed	O
Objective-C	B-Language
from	O
StepStone	O
(	O
the	O
new	O
name	O
of	O
PPI	O
,	O
the	O
owner	O
of	O
the	O
Objective-C	B-Language
trademark	O
)	O
and	O
extended	O
the	O
GCC	B-Application
compiler	I-Application
to	O
support	O
Objective-C	B-Language
.	O
NeXT	O
developed	O
the	O
AppKit	B-Operating_System
and	O
Foundation	B-Operating_System
Kit	I-Operating_System
libraries	O
on	O
which	O
the	O
NeXTSTEP	B-Application
user	O
interface	B-Application
and	O
Interface	B-Application
Builder	O
were	O
based	O
.	O
</s>
<s>
This	O
led	O
NeXT	O
to	O
drop	O
hardware	O
production	O
and	O
focus	O
on	O
software	O
tools	O
,	O
selling	O
NeXTSTEP	B-Application
(	O
and	O
OPENSTEP	B-Operating_System
)	O
as	O
a	O
platform	B-Device
for	O
custom	O
programming	O
.	O
</s>
<s>
In	O
order	O
to	O
circumvent	O
the	O
terms	O
of	O
the	O
GPL	B-License
,	O
NeXT	O
had	O
originally	O
intended	O
to	O
ship	O
the	O
Objective-C	B-Language
frontend	O
separately	O
,	O
allowing	O
the	O
user	O
to	O
link	O
it	O
with	O
GCC	B-Application
to	O
produce	O
the	O
compiler	O
executable	O
.	O
</s>
<s>
Though	O
initially	O
accepted	O
by	O
Richard	O
M	O
.	O
Stallman	O
,	O
this	O
plan	O
was	O
rejected	O
after	O
Stallman	O
consulted	O
with	O
GNU	B-Operating_System
's	O
lawyers	O
and	O
NeXT	O
agreed	O
to	O
make	O
Objective-C	B-Language
part	O
of	O
GCC	B-Application
.	O
</s>
<s>
The	O
work	O
to	O
extend	O
GCC	B-Application
was	O
led	O
by	O
Steve	O
Naroff	O
,	O
who	O
joined	O
NeXT	O
from	O
StepStone	O
.	O
</s>
<s>
The	O
compiler	O
changes	O
were	O
made	O
available	O
as	O
per	O
GPL	B-License
license	I-License
terms	O
,	O
but	O
the	O
runtime	B-Library
libraries	O
were	O
not	O
,	O
rendering	O
the	O
open	O
source	O
contribution	O
unusable	O
to	O
the	O
general	O
public	O
.	O
</s>
<s>
This	O
led	O
to	O
other	O
parties	O
developing	O
such	O
runtime	B-Library
libraries	O
under	O
open	O
source	O
license	O
.	O
</s>
<s>
Later	O
,	O
Steve	O
Naroff	O
was	O
also	O
principal	O
contributor	O
to	O
work	O
at	O
Apple	O
to	O
build	O
the	O
Objective-C	B-Language
frontend	O
to	O
Clang	B-Application
.	O
</s>
<s>
The	O
GNU	B-Operating_System
project	O
started	O
work	O
on	O
its	O
free	B-Application
software	I-Application
implementation	O
of	O
Cocoa	B-Operating_System
,	O
named	O
GNUstep	B-Application
,	O
based	O
on	O
the	O
OpenStep	B-Operating_System
standard	O
.	O
</s>
<s>
Dennis	O
Glatting	O
wrote	O
the	O
first	O
GNU	B-Operating_System
Objective-C	B-Language
runtime	B-Library
in	O
1992	O
.	O
</s>
<s>
The	O
GNU	B-Operating_System
Objective-C	B-Language
runtime	B-Library
,	O
which	O
has	O
been	O
in	O
use	O
since	O
1993	O
,	O
is	O
the	O
one	O
developed	O
by	O
Kresten	O
Krab	O
Thorup	O
when	O
he	O
was	O
a	O
university	O
student	O
in	O
Denmark	O
.	O
</s>
<s>
After	O
acquiring	O
NeXT	O
in	O
1996	O
,	O
Apple	O
Computer	O
used	O
OpenStep	B-Operating_System
in	O
its	O
then-new	O
operating	O
system	O
,	O
Mac	B-Device
OS	I-Device
X	I-Device
.	O
</s>
<s>
This	O
included	O
Objective-C	B-Language
,	O
NeXT	O
's	O
Objective-C-based	O
developer	O
tool	O
,	O
Project	B-Operating_System
Builder	I-Operating_System
,	O
and	O
its	O
interface	B-Application
design	O
tool	O
,	O
Interface	B-Application
Builder	O
.	O
</s>
<s>
Both	O
were	O
later	O
merged	O
into	O
one	O
application	O
,	O
Xcode	B-Operating_System
.	O
</s>
<s>
Most	O
of	O
Apple	O
's	O
current	O
Cocoa	B-Operating_System
API	I-Operating_System
is	O
based	O
on	O
OpenStep	B-Operating_System
interface	B-Application
objects	O
and	O
is	O
the	O
most	O
significant	O
Objective-C	B-Language
environment	O
being	O
used	O
for	O
active	O
development	O
.	O
</s>
<s>
At	O
WWDC	O
2014	O
,	O
Apple	O
introduced	O
a	O
new	O
language	O
,	O
Swift	B-Application
,	O
which	O
was	O
characterized	O
as	O
"	O
Objective-C	B-Language
without	O
the	O
C	B-Language
"	O
.	O
</s>
<s>
Objective-C	B-Language
is	O
a	O
thin	O
layer	O
atop	O
C	B-Language
and	O
is	O
a	O
"	O
strict	O
superset	O
"	O
of	O
C	B-Language
,	O
meaning	O
that	O
it	O
is	O
possible	O
to	O
compile	O
any	O
C	B-Language
program	I-Language
with	O
an	O
Objective-C	B-Language
compiler	O
and	O
to	O
freely	O
include	O
C	B-Language
language	I-Language
code	O
within	O
an	O
Objective-C	B-Language
class	O
.	O
</s>
<s>
Objective-C	B-Language
derives	O
its	O
object	O
syntax	O
from	O
Smalltalk	B-Application
.	O
</s>
<s>
All	O
of	O
the	O
syntax	O
for	O
non-object-oriented	O
operations	O
(	O
including	O
primitive	O
variables	O
,	O
pre-processing	O
,	O
expressions	O
,	O
function	O
declarations	O
,	O
and	O
function	O
calls	O
)	O
are	O
identical	O
to	O
those	O
of	O
C	B-Language
,	O
while	O
the	O
syntax	O
for	O
object-oriented	B-Language
features	O
is	O
an	O
implementation	O
of	O
Smalltalk-style	O
messaging	B-Architecture
.	O
</s>
<s>
The	O
Objective-C	B-Language
model	O
of	O
object-oriented	B-Application
programming	I-Application
is	O
based	O
on	O
message	B-Architecture
passing	I-Architecture
to	O
object	O
instances	O
.	O
</s>
<s>
In	O
Objective-C	B-Language
one	O
does	O
not	O
call	O
a	O
method	O
;	O
one	O
sends	O
a	O
message	O
.	O
</s>
<s>
This	O
is	O
unlike	O
the	O
Simula-style	O
programming	O
model	O
used	O
by	O
C++	B-Language
.	O
</s>
<s>
In	O
a	O
Simula-style	O
language	O
,	O
the	O
method	B-Language
name	I-Language
is	O
in	O
most	O
cases	O
bound	O
to	O
a	O
section	O
of	O
code	O
in	O
the	O
target	O
class	O
by	O
the	O
compiler	O
.	O
</s>
<s>
In	O
Smalltalk	B-Application
and	O
Objective-C	B-Language
,	O
the	O
target	O
of	O
a	O
message	O
is	O
resolved	O
at	B-Library
runtime	I-Library
,	O
with	O
the	O
receiving	O
object	O
itself	O
interpreting	O
the	O
message	O
.	O
</s>
<s>
A	O
method	O
is	O
identified	O
by	O
a	O
selector	O
or	O
—	O
a	O
unique	O
identifier	O
for	O
each	O
message	O
name	O
,	O
often	O
just	O
a	O
-terminated	O
string	O
representing	O
its	O
name	O
—	O
and	O
resolved	O
to	O
a	O
C	B-Language
method	O
pointer	O
implementing	O
it	O
:	O
an	O
.	O
</s>
<s>
A	O
consequence	O
of	O
this	O
is	O
that	O
the	O
message-passing	B-Architecture
system	O
has	O
no	O
type	O
checking	O
.	O
</s>
<s>
Sending	O
the	O
message	O
to	O
the	O
object	O
pointed	O
to	O
by	O
the	O
pointer	O
would	O
require	O
the	O
following	O
code	O
in	O
C++	B-Language
:	O
</s>
<s>
In	O
Objective-C	B-Language
,	O
this	O
is	O
written	O
as	O
follows	O
:	O
</s>
<s>
The	O
"	O
method	O
"	O
call	O
is	O
translated	O
by	O
the	O
compiler	O
to	O
the	O
family	O
of	O
runtime	B-Library
functions	O
.	O
</s>
<s>
In	O
GNU	B-Operating_System
families	O
this	O
function	O
is	O
named	O
,	O
but	O
it	O
has	O
been	O
deprecated	O
in	O
favor	O
of	O
a	O
modern	O
lookup	O
system	O
under	O
.	O
</s>
<s>
Object-oriented	B-Application
programming	I-Application
in	O
the	O
Simula	B-Language
(	O
C++	B-Language
)	O
style	O
allows	O
multiple	B-Application
inheritance	I-Application
and	O
faster	O
execution	O
by	O
using	O
compile-time	O
binding	O
whenever	O
possible	O
,	O
but	O
it	O
does	O
not	O
support	O
dynamic	O
binding	O
by	O
default	O
.	O
</s>
<s>
The	O
Smalltalk-style	O
programming	O
as	O
used	O
in	O
Objective-C	B-Language
allows	O
messages	O
to	O
go	O
unimplemented	O
,	O
with	O
the	O
method	O
resolved	O
to	O
its	O
implementation	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
For	O
example	O
,	O
a	O
message	O
may	O
be	O
sent	O
to	O
a	O
collection	O
of	O
objects	O
,	O
to	O
which	O
only	O
some	O
will	O
be	O
expected	O
to	O
respond	O
,	O
without	O
fear	O
of	O
producing	O
runtime	B-Library
errors	I-Library
.	O
</s>
<s>
Message	B-Architecture
passing	I-Architecture
also	O
does	O
not	O
require	O
that	O
an	O
object	O
be	O
defined	O
at	O
compile	O
time	O
.	O
</s>
<s>
Objective-C	B-Language
requires	O
that	O
the	O
interface	B-Application
and	O
implementation	O
of	O
a	O
class	O
be	O
in	O
separately	O
declared	O
code	O
blocks	O
.	O
</s>
<s>
By	O
convention	O
,	O
developers	O
place	O
the	O
interface	B-Application
in	O
a	O
header	B-Language
file	I-Language
and	O
the	O
implementation	O
in	O
a	O
code	O
file	O
.	O
</s>
<s>
The	O
header	B-Language
files	I-Language
,	O
normally	O
suffixed	O
.h	B-Language
,	O
are	O
similar	O
to	O
C	B-Language
header	I-Language
files	I-Language
while	O
the	O
implementation	O
(	O
method	O
)	O
files	O
,	O
normally	O
suffixed	O
.m	O
,	O
can	O
be	O
very	O
similar	O
to	O
C	B-Language
code	O
files	O
.	O
</s>
<s>
This	O
is	O
analogous	O
to	O
class	O
declarations	O
as	O
used	O
in	O
other	O
object-oriented	B-Language
languages	I-Language
,	O
such	O
as	O
C++	B-Language
or	O
Python	O
.	O
</s>
<s>
The	O
interface	B-Application
of	O
a	O
class	O
is	O
usually	O
defined	O
in	O
a	O
header	B-Language
file	I-Language
.	O
</s>
<s>
A	O
common	O
convention	O
is	O
to	O
name	O
the	O
header	B-Language
file	I-Language
after	O
the	O
name	O
of	O
the	O
class	O
,	O
e.g.	O
</s>
<s>
would	O
contain	O
the	O
interface	B-Application
for	O
the	O
class	O
.	O
</s>
<s>
An	O
interface	B-Application
declaration	O
takes	O
the	O
form	O
:	O
</s>
<s>
In	O
the	O
above	O
,	O
plus	O
signs	O
denote	O
class	B-Application
methods	I-Application
,	O
or	O
methods	O
that	O
can	O
be	O
called	O
on	O
the	O
class	O
itself	O
(	O
not	O
on	O
an	O
instance	O
)	O
,	O
and	O
minus	O
signs	O
denote	O
instance	B-Language
methods	I-Language
,	O
which	O
can	O
only	O
be	O
called	O
on	O
a	O
particular	O
instance	O
of	O
the	O
class	O
.	O
</s>
<s>
Class	B-Application
methods	I-Application
also	O
have	O
no	O
access	O
to	O
instance	B-Application
variables	I-Application
.	O
</s>
<s>
The	O
code	O
above	O
is	O
roughly	O
equivalent	O
to	O
the	O
following	O
C++	B-Language
interface	B-Application
:	O
</s>
<s>
Note	O
that	O
demonstrates	O
the	O
interleaving	O
of	O
selector	O
segments	O
with	O
argument	O
expressions	O
,	O
for	O
which	O
there	O
is	O
no	O
direct	O
equivalent	O
in	O
C/C	O
++	O
.	O
</s>
<s>
Return	O
types	O
can	O
be	O
any	O
standard	O
C	B-Language
type	O
,	O
a	O
pointer	O
to	O
a	O
generic	O
Objective-C	B-Language
object	O
,	O
a	O
pointer	O
to	O
a	O
specific	O
type	O
of	O
object	O
such	O
as	O
NSArray	O
*	O
,	O
NSImage	O
*	O
,	O
or	O
NSString	O
*	O
,	O
or	O
a	O
pointer	O
to	O
the	O
class	O
to	O
which	O
the	O
method	O
belongs	O
(	O
instancetype	O
)	O
.	O
</s>
<s>
The	O
default	O
return	O
type	O
is	O
the	O
generic	O
Objective-C	B-Language
type	O
.	O
</s>
<s>
Method	O
arguments	O
begin	O
with	O
a	O
name	O
labeling	O
the	O
argument	O
that	O
is	O
part	O
of	O
the	O
method	B-Language
name	I-Language
,	O
followed	O
by	O
a	O
colon	O
followed	O
by	O
the	O
expected	O
argument	O
type	O
in	O
parentheses	O
and	O
the	O
argument	O
name	O
.	O
</s>
<s>
A	O
derivative	O
of	O
the	O
interface	B-Application
definition	O
is	O
the	O
category	O
,	O
which	O
allows	O
one	O
to	O
add	O
methods	O
to	O
existing	O
classes	O
.	O
</s>
<s>
The	O
interface	B-Application
only	O
declares	O
the	O
class	O
interface	B-Application
and	O
not	O
the	O
methods	O
themselves	O
:	O
the	O
actual	O
code	O
is	O
written	O
in	O
the	O
implementation	O
file	O
.	O
</s>
<s>
Methods	O
are	O
written	O
using	O
their	O
interface	B-Application
declarations	O
.	O
</s>
<s>
Comparing	O
Objective-C	B-Language
and	O
C	B-Language
:	O
</s>
<s>
Internal	O
representations	O
of	O
a	O
method	O
vary	O
between	O
different	O
implementations	O
of	O
Objective-C	B-Language
.	O
</s>
<s>
If	O
myColor	O
is	O
of	O
the	O
class	O
,	O
instance	B-Language
method	I-Language
might	O
be	O
internally	O
labeled	O
.	O
</s>
<s>
The	O
is	O
to	O
refer	O
to	O
an	O
instance	B-Language
method	I-Language
,	O
with	O
the	O
class	O
and	O
then	O
method	B-Language
names	I-Language
appended	O
and	O
colons	O
changed	O
to	O
underscores	O
.	O
</s>
<s>
As	O
the	O
order	O
of	O
parameters	O
is	O
part	O
of	O
the	O
method	B-Language
name	I-Language
,	O
it	O
cannot	O
be	O
changed	O
to	O
suit	O
coding	O
style	O
or	O
expression	O
as	O
with	O
true	O
named	O
parameters	O
.	O
</s>
<s>
Generally	O
,	O
messages	O
are	O
converted	O
to	O
function	O
calls	O
defined	O
in	O
the	O
Objective-C	B-Language
runtime	B-Library
library	O
.	O
</s>
<s>
It	O
is	O
not	O
necessarily	O
known	O
at	O
link	O
time	O
which	O
method	O
will	O
be	O
called	O
because	O
the	O
class	O
of	O
the	O
receiver	O
(	O
the	O
object	O
being	O
sent	O
the	O
message	O
)	O
need	O
not	O
be	O
known	O
until	O
runtime	B-Library
.	O
</s>
<s>
Once	O
an	O
Objective-C	B-Language
class	O
is	O
written	O
,	O
it	O
can	O
be	O
instantiated	O
.	O
</s>
<s>
Also	O
,	O
some	O
classes	O
implement	O
class	B-Application
method	I-Application
initializers	O
.	O
</s>
<s>
Some	O
class	B-Application
method	I-Application
initializers	O
take	O
parameters	O
:	O
</s>
<s>
The	O
alloc	O
message	O
allocates	O
enough	O
memory	O
to	O
hold	O
all	O
the	O
instance	B-Application
variables	I-Application
for	O
an	O
object	O
,	O
sets	O
all	O
the	O
instance	B-Application
variables	I-Application
to	O
zero	O
values	O
,	O
and	O
turns	O
the	O
memory	O
into	O
an	O
instance	O
of	O
the	O
class	O
;	O
at	O
no	O
point	O
during	O
the	O
initialization	O
is	O
the	O
memory	O
an	O
instance	O
of	O
the	O
superclass	O
.	O
</s>
<s>
This	O
type	O
stands	O
for	O
"	O
pointer	O
to	O
any	O
object	O
"	O
in	O
Objective-C	B-Language
(	O
See	O
the	O
Dynamic	O
typing	O
section	O
)	O
.	O
</s>
<s>
Sends	O
the	O
superclass	O
instance	O
an	O
init	O
message	O
and	O
assigns	O
the	O
result	O
to	O
self	B-Operating_System
(	O
pointer	O
to	O
the	O
current	O
object	O
)	O
.	O
</s>
<s>
Returns	O
the	O
value	O
of	O
self	B-Operating_System
to	O
the	O
caller	O
.	O
</s>
<s>
If	O
there	O
is	O
an	O
error	O
in	O
initialization	O
the	O
init	O
method	O
should	O
perform	O
any	O
necessary	O
cleanup	O
,	O
including	O
sending	O
a	O
"	O
release	O
"	O
message	O
to	O
self	B-Operating_System
,	O
and	O
return	O
nil	O
to	O
indicate	O
that	O
initialization	O
failed	O
.	O
</s>
<s>
In	O
other	O
programming	O
languages	O
,	O
these	O
are	O
called	O
"	O
interfaces	B-Application
"	O
.	O
</s>
<s>
Objective-C	B-Language
was	O
extended	O
at	O
NeXT	O
to	O
introduce	O
the	O
concept	O
of	O
multiple	B-Application
inheritance	I-Application
of	O
specification	O
,	O
but	O
not	O
implementation	O
,	O
through	O
the	O
introduction	O
of	O
protocols	B-Application
.	O
</s>
<s>
This	O
is	O
a	O
pattern	O
achievable	O
either	O
as	O
an	O
abstract	O
multiple	O
inherited	O
base	O
class	O
in	O
C++	B-Language
,	O
or	O
as	O
an	O
"	O
interface	B-Application
"	O
(	O
as	O
in	O
Java	B-Language
and	O
C#	B-Application
)	O
.	O
</s>
<s>
Objective-C	B-Language
makes	O
use	O
of	O
ad	O
hoc	O
protocols	B-Application
called	O
informal	O
protocols	B-Application
and	O
compiler-enforced	O
protocols	B-Application
called	O
formal	O
protocols	B-Application
.	O
</s>
<s>
Informal	O
protocols	B-Application
are	O
implemented	O
as	O
a	O
category	O
(	O
see	O
below	O
)	O
on	O
NSObject	O
and	O
often	O
include	O
optional	O
methods	O
,	O
which	O
,	O
if	O
implemented	O
,	O
can	O
change	O
the	O
behavior	O
of	O
a	O
class	O
.	O
</s>
<s>
The	O
text	O
field	O
discovers	O
whether	O
the	O
delegate	O
implements	O
that	O
method	O
(	O
via	O
reflection	B-Language
)	O
and	O
,	O
if	O
so	O
,	O
calls	O
the	O
delegate	O
's	O
method	O
to	O
support	O
the	O
auto-complete	O
feature	O
.	O
</s>
<s>
A	O
formal	O
protocol	O
is	O
similar	O
to	O
an	O
interface	B-Application
in	O
Java	B-Language
,	O
C#	B-Application
,	O
and	O
Ada	B-Language
2005	I-Language
.	O
</s>
<s>
Versions	O
of	O
Objective-C	B-Language
before	O
2.0	O
required	O
that	O
a	O
class	O
must	O
implement	O
all	O
methods	O
in	O
a	O
protocol	O
it	O
declares	O
itself	O
as	O
adopting	O
;	O
the	O
compiler	O
will	O
emit	O
an	O
error	O
if	O
the	O
class	O
does	O
not	O
implement	O
every	O
method	O
from	O
its	O
declared	O
protocols	B-Application
.	O
</s>
<s>
Objective-C	B-Language
2.0	O
added	O
support	O
for	O
marking	O
certain	O
methods	O
in	O
a	O
protocol	O
optional	O
,	O
and	O
the	O
compiler	O
will	O
not	O
enforce	O
implementation	O
of	O
optional	O
methods	O
.	O
</s>
<s>
This	O
is	O
detectable	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
Formal	O
protocols	B-Application
cannot	O
provide	O
any	O
implementations	O
;	O
they	O
simply	O
assure	O
callers	O
that	O
classes	O
that	O
conform	O
to	O
the	O
protocol	O
will	O
provide	O
implementations	O
.	O
</s>
<s>
In	O
the	O
NeXT/Apple	O
library	O
,	O
protocols	B-Application
are	O
frequently	O
used	O
by	O
the	O
Distributed	O
Objects	O
system	O
to	O
represent	O
the	O
abilities	O
of	O
an	O
object	O
executing	O
on	O
a	O
remote	O
system	O
.	O
</s>
<s>
instances	O
of	O
NSLock	O
claim	O
that	O
they	O
will	O
provide	O
an	O
implementation	O
for	O
the	O
two	O
instance	B-Language
methods	I-Language
.	O
</s>
<s>
Objective-C	B-Language
,	O
like	O
Smalltalk	B-Application
,	O
can	O
use	O
dynamic	O
typing	O
:	O
an	O
object	O
can	O
be	O
sent	O
a	O
message	O
that	O
is	O
not	O
specified	O
in	O
its	O
interface	B-Application
.	O
</s>
<s>
If	O
an	O
object	O
does	O
not	O
forward	O
a	O
message	O
,	O
respond	O
to	O
it	O
,	O
or	O
handle	O
an	O
error	O
,	O
then	O
the	O
system	O
will	O
generate	O
a	O
runtime	B-Library
exception	O
.	O
</s>
<s>
The	O
statements	O
are	O
equivalent	O
at	B-Library
runtime	I-Library
,	O
but	O
the	O
extra	O
information	O
allows	O
the	O
compiler	O
to	O
warn	O
the	O
programmer	O
if	O
the	O
passed	O
argument	O
does	O
not	O
match	O
the	O
type	O
specified	O
.	O
</s>
<s>
In	O
Objective-C	B-Language
,	O
all	O
objects	O
are	O
represented	O
as	O
pointers	O
,	O
and	O
static	O
initialization	O
is	O
not	O
allowed	O
.	O
</s>
<s>
Other	O
types	O
from	O
C	B-Language
,	O
like	O
values	O
and	O
structs	B-Application
,	O
are	O
unchanged	O
because	O
they	O
are	O
not	O
part	O
of	O
the	O
object	B-Language
system	I-Language
.	O
</s>
<s>
This	O
decision	O
differs	O
from	O
the	O
C++	B-Language
object	O
model	O
,	O
where	O
structs	B-Application
and	O
classes	O
are	O
united	O
.	O
</s>
<s>
Objective-C	B-Language
permits	O
the	O
sending	O
of	O
a	O
message	O
to	O
an	O
object	O
that	O
may	O
not	O
respond	O
.	O
</s>
<s>
Forwarding	O
can	O
be	O
used	O
to	O
simplify	O
implementation	O
of	O
certain	O
design	O
patterns	O
,	O
such	O
as	O
the	O
observer	B-Language
pattern	I-Language
or	O
the	O
proxy	O
pattern	O
.	O
</s>
<s>
Notice	O
the	O
SEL	O
type	O
,	O
which	O
is	O
the	O
type	O
of	O
messages	O
in	O
Objective-C	B-Language
.	O
</s>
<s>
Note	O
:	O
in	O
OpenStep	B-Operating_System
,	O
Cocoa	B-Operating_System
,	O
and	O
GNUstep	B-Application
,	O
the	O
commonly	O
used	O
frameworks	O
of	O
Objective-C	B-Language
,	O
one	O
does	O
not	O
use	O
the	O
class	O
.	O
</s>
