3 ms·
It is not only Lisp. PostScript is also homoiconic; tokens have values like any other values (and procedures are just executable arrays (executing an array invo
by zzo38computer 2y ago
It is not only Lisp. PostScript is also homoiconic; tokens have values like any other values (and procedures are just executable arrays (executing an array involves executing each element of that array in sequence), which can be manipulated like any other arrays). The {} block in PostScript is a single token that contains other tokens; the value of the token is an executable array whose elements are the values of the tokens that it contains.
Strings don't make it "homoiconic" in the usual way, I think; so, JavaScript does not count.
- ashton314 2y agoYou might be interested in what the author has to say about weak vs strong homoiconicity then…
- lmm 2y agoThe author doesn't go far enough; eval operating on strings is still very weak (unless your language is something like BrainFuck that really doesn't have a more structured representation available). The point is exposing the structured form that the language implementation runs as datastructures within the language - and not as some second-class reflection API, but directly as they are. You want to be able to capture something like an AST representation (not necessarily literally an AST), manipulate it, and then run it. I think "Bicameral" isn't really a great way to capture this, because there are often multiple layers of parsing/lexing/compilation/interpretation and you might want to hook in at multiple of them (e.g. in lisps you may have both reader macros that operate at a low-level stage and higher-level macros that operate after parsing). And of course it's a spectrum, but essentially the more the language exposes itself as a set of compositional libraries rather than just being a monolithic service.
- astrobe_ 2y agoOn a side note, I was expecting "bicameral" as in [1]. [1] https://en.wikipedia.org/wiki/Bicameral_mentality https://en.wikipedia.org/wiki/Bicameral_mentality