"Gay" as a stable personal identity — a way of being in the world, a self-understanding, a basis for community — is a recent invention. Historians generally locate its emergence in the late nineteenth and early twentieth centuries, when a medical and legal discourse around homosexuality as a type of person (rather than a type of act) began to take hold. Before that discourse existed, men who had sex with men and women who loved women did not, for the most part, understand themselves as members of a category defined by the sex of their objects. They understood themselves in terms of other categories: their class, their religion, their trades, their neighborhoods, their national and ethnic identities.

This does not mean that same-sex sexual behavior was uncommon before the nineteenth century. It clearly was not. It means that the experience of same-sex desire and the formation of intimate same-sex relationships occurred within a different conceptual framework — one that organized social life around acts and relationships rather than identities and orientations.

The distinction between acts and identities is fundamental to Michel Foucault's influential account in The History of Sexuality (1976). Foucault argued that before the late nineteenth century, sodomy was a sin, a crime, a category of forbidden act — but not a basis for identity. The sodomite committed certain acts; he was not, by those acts, constituted as a specific kind of person. The "homosexual," by contrast, was a new kind of subject: a person defined by the direction of their desire, a case history with an etiology, a social type. This transformation — from act to identity — had enormous consequences for how same-sex attachment of all kinds was organized and perceived.

In practice, the period before "gay" as an identity was not a paradise of undifferentiated freedom. Same-sex sexual acts were illegal in most jurisdictions. They were condemned by religious and moral authorities. They were punished, sometimes severely. What was different was the conceptual framework: punishment fell on acts and their immediate perpetrators, not on a class of persons constituted by a type of desire. A man who committed sodomy did not thereby become a sodomite in some permanent, identity-constituting sense. He had done a thing; he had not become a type.

This had specific consequences for same-sex friendship. Intense, affectionate, sometimes physically expressive friendship between men — and between women — was possible and common in a way that later became more fraught. Men could sleep together, touch each other, write of their love for each other, share domestic life — without this being organized under a category that marked them as belonging to a stigmatized class. The category's arrival changed what these behaviors meant, not all at once and not uniformly, but directionally. The question of whether male friends who shared a bed in 1840 were "really gay" is a question that applies a retrospective category to an experience that did not have access to that category. The more useful question is what they were doing, and what it meant in the world they actually inhabited.

Reading the history of same-sex friendship before "gay" as an identity requires holding two things simultaneously: that same-sex desire and love existed throughout the historical record, and that the forms it took, the meanings it carried, and the social world it inhabited were fundamentally different from those available to people who came of age after the concept of gay identity became widespread.