Discriminator. In computing, a discriminator is a field of characters designed to separate a certain element from others of the same identifier. As an example, suppose that a program must save two unique objects to memory, both of whose identifiers happen to be . To ensure the two objects are not conflated, the program may assign discriminators to the objects in the form of numbers; thus,  and  distinguish both objects named .

This has been adopted by programming languages as well as digital platforms for instant messaging and massively multiplayer online games.

In instant messaging 
A discriminator is used to disambiguate a user from other users who wish to identify under the same username.

Discord 
On Discord, a discriminator is a four-digit suffix added to the end of a username. This allowed for up to 10000 user accounts to take the same name.

Transition away from discriminators 
In 2023, co-founder Stanislav Vishnevskiy wrote on a company blog post about the technical debt caused by the discriminator system, stating that the system resulted in nearly half of the company's friend requests failing to connect. The platform implemented discriminators in the early days of the service, he wrote. When the platform was initially introduced, the software developers' priority was to let its users take any username they want without receiving a “your desired username is taken” error. Discord had no friend system at first, thus letting people take names in different letter cases, making usernames case-sensitive.

Discord also introduced a global display name system, wherein a user may input a default nickname to be shown on top of the messages they sent in lieu of their platform-wide username, Vishnevskiy touted on Reddit.

The platform created a transition process to a system of pseudonyms wherein all new usernames would be case-insensitive lowercase and limited to the ASCII characters of A–Z, 0–9, the full stop and the underscore. The transition would happen over the course of months, with the accounts that were registered the oldest, and paid subscribers, receiving the opportunity to reserve their name earlier.

This change was criticized online for being a step backward, as users could be a risk of being impersonated. A notable indie game studio noted that it could no longer claim its own name on the platform. Discord pointed to its processes for users with high visibility and longstanding business relationships with the company for reserving a username under the new system. The old discriminator-oriented system also mitigated the rush to get unique usernames for sale on the black market, leading to swatting and online harassment.

In digital distribution 
Battle.net implements a suffix of four-digit numbers to its usernames.

In computer data storage

Common Object Request Broker Architecture 
A discriminator is a typed tag field present in the Common Object Request Broker Architecture, the interface description language of the Object Management Group. It exists as type and value definitions of tagged unions that determine which union member is selected in the current union instance. This is done by introduction of the classic C switch construct as part of the classic C union. Unlike in some conventional programming languages offering support for unions, the discriminator in IDL is not identical to the selected field name. Here is an example of an IDL union type definition:

union Register switch (char) 
{
    case 'a':
    case 'b': short AX;

    case 'c': long EAX;

    default:  octet AL;
};

The effective value of the Register type may contain AX as the selected field, but the discriminator value may be either 'a' or 'b' and is stored in memory separately. Therefore, IDL logically separates information about the currently selected field name and the union effective value from information about the current discriminator value. In the example above, the discriminator value may be any of the following: 'a', 'b', 'c', as well as all other characters belonging to the IDL char type, since the default branch specified in the example Register type allows the use of the remaining characters as well.

Other interface definition languages 
The Microsoft Interface Definition Language also supports tagged unions, allowing to choose the discriminator via an attribute in an enclosing structure or function.

Alternatives 
A friend code is a unique twelve-digit number that could be exchanged with friends and be used to maintain individual friend lists in each video game. Friend codes were generated from an identifier unique to a copy of a game and the universally unique identifier corresponding to that of a user's device.

References

Programming language topics