|
|
|
|
|
by eggsby
4902 days ago
|
|
How is it that referential transparency (the ability to swap a reference with it's value: no hidden inputs) and homoiconicity (both the source and the resulting syntax tree sharing the same structure) are mutually exclusive? What homoiconicity offers is the macro system, the ability to operate on the syntax tree as a regular language data structure. The difference is a language like Haskell enforces referential transparency where in a lisp it is up to the developer whether or not a function will be referentially transparent. |
|
That was incorrect, I meant: "the kinds of metaprogramming associated with homoiconicity are mutually exclusive with referential transparency".
A macro could not, for instance, take a variable name as an argument and return a result that's based on the value of that variable and maintain referential transparency. So that would be a pretty weak macro system.
I suppose there may be other uses for homoiconicity, but I don't know enough about lisp to comment on that.