Recursive science fiction

Recursive science fiction is a subgenre of science fiction, which itself takes the form of an exploration of science fiction within the narrative of the story.

Analysis
In the book Resnick at Large, authors Mike Resnick and Robert J. Sawyer describe recursive science fiction as, "science fiction about science fiction". In the work, The Greenwood Encyclopedia of Science Fiction and Fantasy: Themes, Works, and Wonders, Gary Westfahl comments, "Recursive fantasy fiction – that is, a fantasy about writing fantasy – is scarce;" one potential example of recursive fantasy, however, would be Patrick Rothfuss' The Kingkiller Chronicle.

Examples
Mike Resnick and Robert J. Sawyer cite Typewriter in the Sky by L. Ron Hubbard as an example of recursive science fiction. Barry N. Malzberg's novel Herovit's World, about a hack science-fiction writer's struggle with the protagonist of his novels, is another. Gary Westfahl writes, "Luigi Pirandello's play Six Characters in Search of an Author (1921) offered a non-genre model." Westfahl noted that Hubbard's book was "an early genre example, perhaps inspired by Pirandello".

Films under the subgenre include Time After Time (1979) and The Time Machine (2002). In Time After Time, H. G. Wells, who wrote The Time Machine, is fictionally portrayed as an inventor of an actual time machine. In the 2002 film The Time Machine, the story by the real-life Wells serves as inspiration for the film's protagonist to invent a time machine.