Self-reference occurs in natural or formal languages when a sentence, idea or formula refers to itself. The reference may be expressed either directly—through some intermediate sentence or formula—or by means of some encoding. In philosophy, it also refers to the ability of a subject to speak of or refer to itself: to have the kind of thought expressed by the first person nominative singular pronoun, the word "I" in English.
Self-reference is studied and has applications in mathematics, philosophy, computer programming, and linguistics. Self-referential statements are sometimes paradoxical, and can also be considered recursive.
Self-reference occurs in literature and film when an author refers to his or her own work in the context of the work itself. Famous examples include Cervantes's Don Quixote, Shakespeare's A Midsummer Night's Dream, Denis Diderot's Jacques le fataliste et son maître, Italo Calvino's If on a winter's night a traveler, many stories by Nikolai Gogol, Lost in the Funhouse by John Barth, Luigi Pirandello's Six Characters in Search of an Author and Federico Fellini's 8½. This is closely related to the concepts of breaking the fourth wall and meta-reference, which often involve self-reference.