Discriminator
In computing, a discriminator is a field of characters designed to separate a certain element from others of the same identifier.[src] As an example, suppose that a program must save two unique objects to memory, both of whose identifiers happen to be .[src] 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 .[src] This has been adopted by programming languages as well as digital platforms for instant messaging and massively multiplayer online games.[src]
In computing, a discriminator is a field of characters designed to separate a certain element from others of the same identifier.[src] As an example, suppose that a program must save two unique objects to memory, both of whose identifiers happen to be .[src] 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 .[src] This has been adopted by programming languages as well as digital platforms for instant messaging and massively multiplayer online games.[src] 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.[src] Therefore, IDL logically separates information about the currently selected field name and the union effective value from information about the current discriminator value.[src] 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.[src] { "$type": "book", "title": "Do Androids Dream of Electric Sheep?", "author": "Philip K.[src] Dick" } A serialization of a movie.[src] { "$type": "movie", "title": "Titanic", "director": "James Cameron" } Both data serializations share a common field here named "$type" which serves as the type discriminator.[src] The book have the book-specific field "author", while the movie have the movie-specific field "director".[src] This facilitates the deserialization of data to different classes depending on the value of the type discriminator.[src] ==References==[src]
17 sentences · 17 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Discriminator." encyclopegia.org, 2026, https://encyclopegia.org/wiki/discriminator. Accessed 04 December 2026.
Chicago
"Discriminator." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/discriminator.
APA
encyclopegia.org. (2026). Discriminator. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/discriminator
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON