<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
reflective	B-Language
programming	I-Language
or	O
reflection	O
is	O
the	O
ability	O
of	O
a	O
process	B-Operating_System
to	O
examine	O
,	O
introspect	B-Application
,	O
and	O
modify	O
its	O
own	O
structure	O
and	O
behavior	O
.	O
</s>
<s>
The	O
earliest	O
computers	O
were	O
programmed	O
in	O
their	O
native	O
assembly	B-Language
languages	I-Language
,	O
which	O
were	O
inherently	O
reflective	O
,	O
as	O
these	O
original	O
architectures	O
could	O
be	O
programmed	O
by	O
defining	O
instructions	O
as	O
data	O
and	O
using	O
self-modifying	B-Application
code	I-Application
.	O
</s>
<s>
As	O
the	O
bulk	O
of	O
programming	O
moved	O
to	O
higher-level	O
compiled	B-Language
languages	I-Language
such	O
as	O
Algol	B-Language
,	O
Cobol	B-Application
,	O
Fortran	B-Application
,	O
Pascal	B-Application
,	O
and	O
C	B-Language
,	O
this	O
reflective	O
ability	O
largely	O
disappeared	O
until	O
new	O
programming	O
languages	O
with	O
reflection	O
built	O
into	O
their	O
type	O
systems	O
appeared	O
.	O
</s>
<s>
Brian	O
Cantwell	O
Smith	O
's	O
1982	O
doctoral	O
dissertation	O
introduced	O
the	O
notion	O
of	O
computational	B-Language
reflection	I-Language
in	O
procedural	O
programming	O
languages	O
and	O
the	O
notion	O
of	O
the	O
meta-circular	B-Application
interpreter	I-Application
as	O
a	O
component	O
of	O
3-Lisp	O
.	O
</s>
<s>
Reflection	O
helps	O
programmers	O
make	O
generic	O
software	O
libraries	O
to	O
display	O
data	O
,	O
process	B-Operating_System
different	O
formats	O
of	O
data	O
,	O
perform	O
serialization	B-Application
or	O
deserialization	B-Application
of	O
data	O
for	O
communication	O
,	O
or	O
do	O
bundling	O
and	O
unbundling	O
of	O
data	O
for	O
containers	O
or	O
bursts	O
of	O
communication	O
.	O
</s>
<s>
For	O
example	O
,	O
it	O
assists	O
languages	O
such	O
as	O
Java	B-Language
to	O
operate	O
well	O
in	O
networks	O
by	O
enabling	O
libraries	O
for	O
serialization	B-Application
,	O
bundling	O
and	O
varying	O
data	O
formats	O
.	O
</s>
<s>
Languages	O
without	O
reflection	O
such	O
as	O
C	B-Language
are	O
required	O
to	O
use	O
auxiliary	O
compilers	O
for	O
tasks	O
like	O
Abstract	B-Protocol
Syntax	I-Protocol
Notation	I-Protocol
to	O
produce	O
code	O
for	O
serialization	B-Application
and	O
bundling	O
.	O
</s>
<s>
Reflection	O
can	O
be	O
used	O
for	O
observing	O
and	O
modifying	O
program	O
execution	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
This	O
is	O
typically	O
accomplished	O
by	O
dynamically	O
assigning	O
program	O
code	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
In	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
such	O
as	O
Java	B-Language
,	O
reflection	O
allows	O
inspection	O
of	O
classes	O
,	O
interfaces	O
,	O
fields	O
and	O
methods	O
at	B-Library
runtime	I-Library
without	O
knowing	O
the	O
names	O
of	O
the	O
interfaces	O
,	O
fields	O
,	O
methods	O
at	O
compile	B-Application
time	I-Application
.	O
</s>
<s>
Reflection	O
is	O
often	O
used	O
as	O
part	O
of	O
software	O
testing	O
,	O
such	O
as	O
for	O
the	O
runtime	B-Library
creation/instantiation	O
of	O
mock	O
objects	O
.	O
</s>
<s>
Reflection	O
is	O
also	O
a	O
key	O
strategy	O
for	O
metaprogramming	B-Application
.	O
</s>
<s>
In	O
some	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
such	O
as	O
C#	B-Application
and	O
Java	B-Language
,	O
reflection	O
can	O
be	O
used	O
to	O
bypass	O
member	O
accessibility	O
rules	O
.	O
</s>
<s>
For	O
C#	B-Application
-properties	O
this	O
can	O
be	O
achieved	O
by	O
writing	O
directly	O
onto	O
the	O
(	O
usually	O
invisible	O
)	O
backing	O
field	O
of	O
a	O
non-public	O
property	O
.	O
</s>
<s>
This	O
works	O
for	O
project-internal	O
files	O
as	O
well	O
as	O
external	O
libraries	O
such	O
as	O
.NET	B-Application
'	O
s	O
assemblies	O
and	O
Java	B-Language
's	O
archives	O
.	O
</s>
<s>
A	O
language	O
supporting	O
reflection	O
provides	O
a	O
number	O
of	O
features	O
available	O
at	B-Library
runtime	I-Library
that	O
would	O
otherwise	O
be	O
difficult	O
to	O
accomplish	O
in	O
a	O
lower-level	O
language	O
.	O
</s>
<s>
as	O
first-class	O
objects	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
Evaluate	O
a	O
string	O
as	O
if	O
it	O
were	O
a	O
source-code	O
statement	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
Create	O
a	O
new	O
interpreter	B-Application
for	O
the	O
language	O
's	O
bytecode	O
to	O
give	O
a	O
new	O
meaning	O
or	O
purpose	O
for	O
a	O
programming	O
construct	O
.	O
</s>
<s>
In	O
MOO	B-Application
,	O
reflection	O
forms	O
a	O
natural	O
part	O
of	O
everyday	O
programming	O
idiom	O
.	O
</s>
<s>
Compiled	B-Language
languages	I-Language
rely	O
on	O
their	O
runtime	B-Library
system	O
to	O
provide	O
information	O
about	O
the	O
source	O
code	O
.	O
</s>
<s>
A	O
compiled	O
Objective-C	B-Language
executable	O
,	O
for	O
example	O
,	O
records	O
the	O
names	O
of	O
all	O
methods	O
in	O
a	O
block	O
of	O
the	O
executable	O
,	O
providing	O
a	O
table	O
to	O
correspond	O
these	O
with	O
the	O
underlying	O
methods	O
(	O
or	O
selectors	O
for	O
these	O
methods	O
)	O
compiled	O
into	O
the	O
program	O
.	O
</s>
<s>
In	O
a	O
compiled	B-Language
language	I-Language
that	O
supports	O
runtime	B-Library
creation	O
of	O
functions	O
,	O
such	O
as	O
Common	B-Language
Lisp	I-Language
,	O
the	O
runtime	B-Library
environment	O
must	O
include	O
a	O
compiler	O
or	O
an	O
interpreter	B-Application
.	O
</s>
<s>
Reflection	O
can	O
be	O
implemented	O
for	O
languages	O
without	O
built-in	O
reflection	O
by	O
using	O
a	O
program	B-Application
transformation	I-Application
system	I-Application
to	O
define	O
automated	O
source-code	O
changes	O
.	O
</s>
<s>
Historical	O
vulnerabilities	O
in	O
Java	B-Language
caused	O
by	O
unsafe	O
reflection	O
allowed	O
code	O
retrieved	O
from	O
potentially	O
untrusted	O
remote	O
machines	O
to	O
break	O
out	O
of	O
the	O
Java	B-Language
sandbox	O
security	O
mechanism	O
.	O
</s>
<s>
A	O
large	O
scale	O
study	O
of	O
120	O
Java	B-Language
vulnerabilities	O
in	O
2013	O
concluded	O
that	O
unsafe	O
reflection	O
is	O
the	O
most	O
common	O
vulnerability	O
in	O
Java	B-Language
,	O
though	O
not	O
the	O
most	O
exploited	O
.	O
</s>
<s>
The	O
following	O
code	O
snippets	O
create	O
an	O
instance	O
of	O
class	O
and	O
invoke	O
its	O
method	B-Language
.	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
C#	B-Application
:	O
</s>
<s>
This	O
Delphi/Object	O
Pascal	O
example	O
assumes	O
that	O
a	O
class	O
has	O
been	O
declared	O
in	O
a	O
unit	O
called	O
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
eC	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Go	B-Application
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Java	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
JavaScript	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Julia	B-Application
(	O
programming	O
language	O
)	O
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Objective-C	B-Language
,	O
implying	O
either	O
the	O
OpenStep	B-Operating_System
or	O
Foundation	B-Operating_System
Kit	I-Operating_System
framework	O
is	O
used	O
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Perl	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
PHP	B-Application
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Python	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
R	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
in	O
Ruby	B-Language
:	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
using	O
Xojo	B-Application
:	O
</s>
