|
|
|
|
|
by ken
5194 days ago
|
|
Disclaimer: I don't know anything about Julia, except from reading a couple simple programs just now, and seeing that it uses syntax that looks somewhat like Algol. I don't think there's any inherent contradiction between the two, depending on what you mean by "the power of homoiconicity" (1). Homoiconicity doesn't mean you need to use lists: you could make a language like C but with native structures to hold all of the syntax. It's just that "cons cell and symbol" happen to be a really simple set of tools from which you can build everything you need. I suspect that languages that try to have both do it by sacrificing simplicity. They have syntax that looks like C, and then make it homoiconic by building essentially a DOM for all of that syntax. Perhaps the idea is that writing and reading "x = y + z" is deemed sufficiently common that they're OK with making metaprogramming more complex if they get to keep Algol syntax. (1) By "depends on what you mean", I meant: is simplicity requisite for power? I would say "yes", but I can imagine there's someone who would say "no" and consider Algol-plus-DOM (is that what Julia is?) to be as powerful as simpler languages. |
|
But I think to be homo- (same) iconic (symbols), the language has to be those symbols. By this strict definition, it has to be a lisp. Maybe there's a looser definition possible, between a DOM and Lisp. I think a parallel lisp-syntax would do it (i.e. you can write everything using a lispy syntax; but there's also a friendlier syntax.
hmmmm, you could do this for any language, provided a AST representation (i.e. lispy) syntactically unambiguous with the rest. That subset of the language would then be homoiconic. e.g. add a first-class AST syntax to Java. Is that the kind of DOM you were thinking of?