5 ms·
I think this definition makes sense, though I agree with https://news.ycombinator.com/item?id=23426047 https://news.ycombinator.com/item?id=23426047 that the no
by tom_mellior 6y ago
I think this definition makes sense, though I agree with https://news.ycombinator.com/item?id=23426047 https://news.ycombinator.com/item?id=23426047 that the notion of homoiconicity, and therefore a precise definition of it, is not really useful.
What I'm disappointed by is the analysis of the examples and counter-examples, which even for a cursory analysis is somewhat sloppy. For example: "S-expressions are trees, and the nesting of items is immediately apparent: ( denotes the start of a child, and ) its end." Not really, as I would say that "(f x y z)" either has four children, or one distinguished function symbol and three children. But there is only one pair of parentheses. Even if you take the reductionist view that there really are two children, namely "f" and "(x y z)", there is only one pair of parentheses in the original.
Further: "JavaScript has strong language support for composable, tree-like, structures (bullet 1) and the structure is immediately apparent by looking at the pairs of { and } brackets (bullet 3)." It's more complicated than that, since "f(g(x + y * z))" is also highly structured, and much of the structure is immediately apparent, but some of it isn't because it uses precedence rules. Also, no {} in sight. And then: "Java has no strong language support for literal representation of simple composable data in the language (bullet 1) and also fails to meet the other criteria." I don't see how Java fails bullet 3 if JavaScript is claimed to pass it. The syntax uses {} and other grouping and expression forming mechanisms in essentially the same way. If anything, Java makes structure a tiny bit more explicit since it requires explicit semicolons to delimit statements.
- memorythought 6y agoI read the javascript part as specifically referring to JSON, not to all javascript code.
- tom_mellior 6y agoInteresting. I don't think that's the intended reading, since there are lots of references throughout to "programs", but JSON files aren't programs in the same sense as JavaScript files are. Also there is an explicit distinction between JavaScript and JSON in the article: "...a JavaScript program is not provided as a JavaScript object (or JSON object)".
- cies 6y ago> I don't see how Java fails bullet 3 if JavaScript is claimed to pass it. I understood it as Java not having a data structure that can be used as a tree available as literal. JS has that. This is valid JS but not valid Java: [[1, 2, [1, 2, []]], [[], [], 0], 1, 2, 3]
- tom_mellior 6y agoIt might not be what the article meant since it only mentioned { } braces in connection with JavaScript, but this is a very good point!