Hacker News new | past | comments | ask | show | jobs | submit login

Yes. See Smalltalk for a language with object-oriented homoiconicity.



That's not really homoiconicity though, is it?

Smalltalk source code does not appear to be expressed in terms of a Smalltalk data structure. Whereas Lisp source code is expressed as lists of lists.


Sure it is. All parts of a Smalltalk program are present as objects that can be manipulated by sending them messages. Classes, methods, variable bindings, closures, stack frames, even individual messages are objects.

As a practical matter, methods also have a textual representation, but that's not strictly necessary. Ten or fifteen years ago, the Squeak method browser had a mode where you could write Smalltalk code using tiles, kind of like in Etoys, no parsing necessary. That was a hassle to use, though, so people stuck with writing methods using text.

By the way, Lisp has the same sort of "impurity". S-expressions are very simple, but they are syntax. It's surely possible to create a tool that would let one construct cons cells in memory directly, but that would be a hassle. Instead we use parentheses.


The 'iconicity' part of homoiconicity refers to the textual representation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: