|
|
|
|
|
by Zambyte
974 days ago
|
|
> Scheme might be different here [...] Yep, I meant to specify that a subset of your original claim is true for all Lisps, not that your claim was not true for certain ones like CL. > IMO, the useful definition of homoiconicity is "the domain and codomain of eval are the same type". I do not think that is a useful definition. Under that definition, any language can be made homoiconic by providing a library with an eval procedure that accepts an AST where nodes in the tree could be non syntax objects, and their value is just accepted as-is for evaluation. The most useful definition of homoiconic IMO is that the internal representation of the language (the AST) is the same as the external representation of the language (the literal text you write). In that sense, CL and Scheme are equally homoiconic, but Python, C, etc. which you could provide an evaluator for with the same domain and codomain types, are not homoiconic. |
|
Except this is never true, unless your AST is a string. And Racket’s internal representation (syntax objects) is much more complicated than what is apparent from the text. So, in my opinion, defining homoiconicity in terms of the textual syntax is basically impossible. (And I’m sympathetic to Shriram Krishnamurthi’s claim that homoiconicity doesn’t mean anything).
The interesting property, in my opinion, is that languages like Common Lisp are not specified in terms of the textual syntax and so the textual representation is irrelevant to the semantics of the program: a visual tool that produces lisp forms is as valid a “syntax” of Common Lisp as the standardized textual representation produced by READ.