COMPUTING SCIENCE
Identity Crisis
Brian Hayes
More of the Same
There is a third way of exploring issues of identity, but it lies
outside the realm of nondestructive testing. If Alex spills ketchup
on his tie, does Baxter's tie also acquire a stain? If Baxter steps
on his teacher's toe, does Alex's teacher have a sore foot? The
principle being suggested here is that two things are the selfsame
thing if changing one of them changes the other in the same way.
In computing, this process is encountered most often in the
unexpected and unpleasant discovery that two variables are
"aliases" referring to the same value or object. For
example, if the variable designating Alex's grade-point average and
the variable for Baxter's average both point to the same location in
memory, then any change in one value will also be reflected in the
other. This is probably not the desired behavior of the school's
grading system.
In principle, deliberate alteration of memory contents could serve
as a test of identity: Just twiddle the bits of an object and see if
the corresponding bits of another object flip. But the test is not
foolproof, particularly in a computer with multiple threads of
execution. There's always the chance that the same change might be
made coincidentally in two different places; two independent ketchup
stains are not an impossibility. If coincidence seems too unlikely,
consider that there might be a process running whose purpose is to
synchronize two variables, checking one of them at frequent
intervals and changing the other one to match. Or, conversely, a
background process might undo any change to a variable, restoring
the original value whenever it is modified. Under these conditions,
a bit-flipping identity test might find that an object is not even
equal to itself.
The distinction between separate-but-equal objects and a selfsame
object can be crucially important. When I make a bank deposit, I'd
strongly prefer that the amount be credited to my own selfsame
account, rather than to the account of someone who is
separate-but-equal to me—perhaps someone with the same name
and date of birth. The standard practice for maintaining identity in
these circumstances is to issue a unique identifying number. These
are the numbers that rule so much of modern life, the ones you find
on your bank statement, your driver's license, your credit cards.
The same technique can be used internally by a computer program to
keep track of data objects. For example, the programming language
Smalltalk tags all objects with individual serial numbers.
(Smalltalk is also notable for having two equality operators:
"=" for separate-but-equal objects and "==" for
selfsame objects.)
» Post Comment