TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Don't Say “Homoiconic” (2018)

88 pointsby dmuxalmost 6 years ago

19 comments

dwheeleralmost 6 years ago
Like most people, I&#x27;m going to keep using the word &quot;homoiconic&quot; because it is a useful term.<p>The article just shows that if you insist on an absurdly strict definition you end up with nonsense. Even the &quot;strings&quot; based definition doesn&#x27;t work if you&#x27;re being especially literal, since there are no strings, there are just electrical fields that may or may not be in physically nearby places.<p>Everything in software is, at some level, an abstraction. And that&#x27;s okay.<p>S-expressions are merely a textual representation; Lisp systems don&#x27;t normally store exactly the text representation. So what? The upshot is that homoiconic representations make certain kinds of transformations easy to use, understand, and display... and that&#x27;s what people mean today.<p>I agree that homoiconicity is not strictly boolean, but that doesn&#x27;t make it a useless concept.
评论 #20671776 未加载
评论 #20670695 未加载
评论 #20681613 未加载
omarantoalmost 6 years ago
How about &quot;defining&quot; homoiconic to mean that it&#x27;s easy to manipulate programs? More specifically, say a programming language is homoiconic if (1) the standard library for the language includes a parser, and (2) the parser returns data structures that are easily manipulated by functions in the standard library.<p>Point (2) can be achieved by having the parser return generic data structures such as lists, arrays and hashtables for which the standard library will probably have lots of convenient functions (this what Lisps do); or by having a dedicated AST data type, but including a bunch of AST manipulation functions in the standard library (like Template Haskell).<p>Of course, this isn&#x27;t a very precise definition because it relies on the undefined terms &quot;parse&quot; and &quot;easily manipulated&quot;. Does read_file_to_string() count as a (trivial) parser that produces strings, which can be easily manipulated by standard string functions? The idea is this doesn&#x27;t count, but I&#x27;ll leave the problem of defining what counts as a parser to other philosophers of programming languages. :)
评论 #20669784 未加载
评论 #20669394 未加载
评论 #20670322 未加载
评论 #20672800 未加载
评论 #20672237 未加载
macmacalmost 6 years ago
&gt; &quot;In a homoiconic language, the primary representation of programs is also a data structure in a primitive type of the language itself.&quot;<p>I believe the author is misreading this definition.<p>&gt; &quot;First, consider that most languages have a primitive datatype for strings of text&quot;<p>The defintion says &quot;data structure&quot;, not &quot;datatype&quot;. A string is a datatype, not a datastructure.<p>&gt; &quot;Second, for most languages, it is possible to write a parser in that language itself, that stores the resulting abstract syntax tree in a primitive type in the language.&quot;<p>This is completely besides the point as the definition references the &quot;primary representation&quot;, not a represenation that can be built using a parser.
评论 #20669332 未加载
评论 #20669365 未加载
评论 #20674515 未加载
评论 #20658212 未加载
ScottBursonalmost 6 years ago
I haven&#x27;t found the term particularly useful either. What I do like to say is that in Lisp, <i>the AST is a public interface</i>. That is, the AST is defined by a specification and is not going to change, so that you can write code that manipulates it and know that the next compiler version won&#x27;t break your code — indeed, it&#x27;s portable across implementations. Also, the AST&#x27;s structure is relatively simple to explain (though there are some &quot;gotchas&quot; you have to watch out for when manipulating it, like inadvertent variable capture), and macros provide a convenient interface for receiving an AST from the compiler or interpreter and supplying back a transformed AST.<p>Other languages could provide similar facilities, and indeed a few have done so. But the more complex the syntax of the language, the more difficult it is to do that in a usable way.
delishalmost 6 years ago
I agree with the conclusion, that what we call homoiconicity is a scalar, not a boolean. And I agree both in this case and in general that people should talk about languages more directly (“the syntax is easy to parse”, “the semantics of the language are completely defined on the single page of a book”) rather than label them as homoiconic or not.<p>If you&#x27;d like good argument for writing in languages that call themselves homoiconic, you can see Bawden&#x27;s Quasiquotation in Lisp. Its section 2.1 compares writing a program that generates programs in C, versus Lisp, first without quasiquotation, then with.<p><a href="https:&#x2F;&#x2F;3e8.org&#x2F;pub&#x2F;scheme&#x2F;doc&#x2F;Quasiquotation%20in%20Lisp%20(Bawden).pdf" rel="nofollow">https:&#x2F;&#x2F;3e8.org&#x2F;pub&#x2F;scheme&#x2F;doc&#x2F;Quasiquotation%20in%20Lisp%20...</a>
评论 #20669316 未加载
galaxyLogicalmost 6 years ago
&quot;... the original definition: languages which have the same external and internal representations are homoiconic.&quot;<p>I would re-phrase that as: &quot;Languages whose external and internal representations of their programs are (to a great degree) ISOMORPHIC, are, and should be, called homoiconic.&quot;<p>What does &quot;iconicity&quot; mean? It means isomorphism, meaning the structure of two things are similar, one can be taken to be a picture, an &quot;icon&quot; of the other.<p>Lisp clearly has this property. It is clearly homo-iconic. And most importantly most other languages do NOT have this property. Therefore &quot;homo-iconic&quot; is a very useful property which can be easily used to divide programming languages into two groups, those that are and those that aren&#x27;t.<p>The original definition is bad: &quot;which have the SAME external and internal representations&quot;. &quot;Sameness&quot; is not what homo-iconicity is about. It is about the structures of the external and internal representation being SIMILAR enough that one of them could be considered an ICON, a PICTURE of the other. Perhaps we should stop using words like &quot;similar&quot; as well? They are not &quot;boolean&quot; are they?<p>Clearly &#x27;homo-iconic&quot; has a sound well-founded meaning, even if not everybody gets it. It is a subtle concept similar to understanding why something can be used as a metaphor for another thing. Not everybody gets metaphors either.
评论 #20672677 未加载
ivarvalmost 6 years ago
An excellent talk by Sturart Sierra that covers much of the same ground &quot;Homoiconicity: It Is What It Is&quot; <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=o7zyGMcav3c" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=o7zyGMcav3c</a><p>spoiler: his talk also does not finish with a definition of homoiconic either
charlieflowersalmost 6 years ago
My response: clever article, but whatevs.<p>Lisp is homoiconic because the syntax for code matches the syntax for a list. Keep saying it.
nocmanalmost 6 years ago
To me this article feels like someone working really hard to find an objection to something (may or may not be true, but it feels that way to me).<p>The first line of the article&#x27;s conclusion is &quot;Homoiconicity is a term surrounded by much confusion.&quot; I simply do not agree with this assertion.<p>I was introduced to the term many years ago, and I have have read it in numerous contexts, and the meaning has been quite clear in every context I can recall.<p>I also will keep using it the way I am now, since I see absolutely no reason to stop.
gumbyalmost 6 years ago
My only problem is that the term is a feature not a benefit. The two most powerful ideas in lisp are the lack of statements (everything is an expression, even atoms) and the macrology (which pretty much requires expression-only, and of course requires the Mooers&#x2F;Deutsch coinage of...homoiconicity).<p>Eval is great but unavoidably requires special forms. That&#x27;s just life: you can&#x27;t be circular; at best you can be metacircular. It&#x27;s like the second law of thermodynamics.
appleflaxenalmost 6 years ago
This is a great article. It takes a pedantic point about an answer that &quot;everybody knows&quot;, and manages to make a compelling case that the way we use this vocabulary is suboptimal.<p>Great find!
lispmalmost 6 years ago
I&#x27;m not a big fan of &#x27;homoiconic&#x27; either. I&#x27;m more in the &#x27;source code as data&#x27; camp.<p>&gt; The first objection concerns the external representation. In the above we simply stated that the external representation is an s-expression. In most practical programming environments, however, the actual representation of program sources is as text files which contain strings of characters. It is only after parsing this text that the representation is really an s-expression. In other words: in practical environments the external representation is not an s-expression, but text.<p>The point is that Lisp s-expressions are an external representation of data and that Lisp programs are represented as s-expressions. Various programmatic interfaces see this source code as data: for example the function EVAL or the macro expander.<p>&gt; The second objection concerns the internal representation. Practical implementations of Lisp interpreters do generally not operate actually directly on s-expressions internally for performance reasons.<p>Actually they do. The definition of &#x27;Lisp interpreter&#x27; is that it operates on source code as data (lists, symbols, ...). Lisp has other ways to execute: as compiled byte code, as compiled native code, etc. -&gt; but that&#x27;s not a Lisp interpreter.
k__almost 6 years ago
I always had the impression homoiconicity could be used to do interesting machine learning applications, becauee the programm could easily modify itself. Did this happen?
评论 #20669984 未加载
评论 #20669649 未加载
taericalmost 6 years ago
<a href="http:&#x2F;&#x2F;taeric.github.io&#x2F;CodeAsData.html" rel="nofollow">http:&#x2F;&#x2F;taeric.github.io&#x2F;CodeAsData.html</a> is where I took my stab. Lisp is the main language I know where you can write a function, and write code that can both symbolically run a derivative, and let you use that derivative just like any other function. Without having to dive into a bunch of AST specific structures to do it.<p>It really is a shame that people think the eval of javascript and python is equivalent to the eval of lisp. It is crazy just how different they are, once you see it.
kazinatoralmost 6 years ago
Kind of echoes a reddit comment I wrote two years ago:<p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;lisp&#x2F;comments&#x2F;5h2kdc&#x2F;homoiconicity&#x2F;dax1ude&#x2F;?st=jz91ye0l&amp;sh=92838870" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;lisp&#x2F;comments&#x2F;5h2kdc&#x2F;homoiconicity&#x2F;...</a>
nudpiedoalmost 6 years ago
What about using the word &quot;homoiconic&quot; when we mean its meaning: &quot;homogenous icons&quot; other said, a regular and equivalent representation of all its tokens. The article sort of tries to validate its point from a historical approach, but kind of ignores the meaning of the word by its compounds. Will continue using it.
throwaway3627almost 6 years ago
The HP 48 calculator seems fairly homoiconic. Binary compiled programs and symbolic ones alike can be pushed on the stack, stored, dropped.
starpilotalmost 6 years ago
Way ahead of you there, bud.
jstewartmobilealmost 6 years ago
Ugh. Comp sci has enough Andy Rooneys already.