What immunity isn't
I seem to have become a full time critic of Radio 4. Recently, the station has been running trails for a documentary looking at how rats have developed immunity to all common rat poisons. Erm. Is that right? I didn't catch the documentary and I'm no immunologist, but I'm pretty sure that rats are not immune to poisons. They are, perhaps, tolerant or resistant to the poisons. The difference illustrates an interesting principle of animal evolution.
Tolerance (or resistance) is a direct product of selection: the poison kills all those individuals that are not tolerant, while those individuals which just happen to carry a mutation that makes them at least partially tolerant -- e.g. by flushing the poison out of the body, breaking it up into harmless components, or by modifying those biological molecules with which the poison interacts -- survive, and pass on their tolerance. Tolerance is the result, therefore, of long-term exposure to the single poison, and is specific to that single poison (though it may rely on some general principles, like having a liver and kidney to clean up the body).
Evolution is a fantastically powerful way of producing systems capable of performing complex tasks, like pumping nasty things out of the body. But those systems are made the hard way: through the deaths of those which do not possess them. Every time a novel killer arrives on the scene, a new catastrophe unfolds. This is especially a problem with pathogens, because pathogens evolve much faster than we ever could. An individual who is capable of adjusting to new threats would have an enormous advantage over those who play the lottery with them. The immune system provides just such a capability.
Immunity, then, is not a direct result of evolution, but is produced by an immune system; and unlike resistance, it is not hard wired. Once you have an immune system, you can gain immunity to new threats throughout your life. But the immune system has an interesting evolutionary tale of its own. The adaptive immune system -- that part which learns and remembers specific threats -- works by utilising evolutionary processes within individuals, rather than over multiple generations. B-lymphocyte cells produce receptors -- proteins that stick out from the cell surface -- that allow them to recognise foreign cells, and it is these receptors that are the subject of this internal evolution. The genes that encode these proteins undergo a process of "somatic hyper-mutation": they are deliberately damaged. Thus a population of B-cells contains a huge variety of these proteins, and between them, are capable of recognising most potential threats, at least hazily. But evolution is, of course, more than just mutation: what about selection? Well, selection events take place when a B-cell actually encounters a pathogen that it recognises. At this point, it proliferates, producing lots of copies, which because of hyper-mutation, exhibit slight variation in their ability to recognise the pathogen.
Thus, while the immune system is something that, like resistance, has evolved the hard way over hundreds of generations, through the deaths of those that don't have one; immunity is something that is evolving within each of us at a rate that allows us to keep up with fast evolving threats.