Homoiconicity

tags
Software Development

Homoiconicity in a programming language refers to similarity between human and machine representations of code.

Things get philosophical extremely quickly when we try to break down exactly what this means. What is "code"? What is a "representation"? What is "similarity"? What is "human" and what is "machine"? See Don't Say "Homoiconic" for a Lisper's uneasy account of homoiconicity.

I like @hlprmnky's take:


cf Aaron Sloman's comparison of “analogical” vs “Fregean” representations: “In an analogical system properties of and relations between parts of the representing configuration represent properties and relations of parts in a complex represented configuration, so that the structure of the representation gives information about the structure of what is represented,”1 whereas Fregean signs are purely referential.

Origins

"homo" meaning same, "icon" meaning representation.
The term was originally coined to describe the text-processing language TRAC: "The external and internal forms of the TRAC language are the same." The forms in question are, however, byte sequences, which by modern reckoning strains the definition of homoiconicity - of course, everything can be represented as a byte sequence! But other people ran with the idea, particularly Lispers.
The implementer of TRAC later (2020) said that in his view, homoiconicity refers specifically to appearances, and is to programming as WYSIWYG is to text editing.

Homoiconicity: It Is What It Is - Stuart Sierra - YouTube

"In a homoiconic language, code is written with literal representations of its principal data structures."

Footnotes:

1

Aaron Sloman, “Interactions between Philosophy and Artificial Intelligence: The Role of Intuition and Non-Logical Reasoning in Intelligence,” Artificial Intelligence 2, no. 3-4 (1971): 209–25, https://www.sciencedirect.com/science/article/pii/0004370271900117.