Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's very different since Lisp doesn't 'compile and run strings', it treats code as data structures - which means you can manipulate code just like data since they live in the same space, so to speak.

And also, it has nothing to do with the syntax (+ 1 1), the keyword is homoiconicity.



You mean a toy LISP or Scheme? Any serious LISP system uses a compiler. It compiles and runs strings. The "eval" creates native binary executable code.

No decent-performing system totally skips compilation. You just don't notice that it is happening. Even a web browser compiles the javascript before running it; that is what a JIT does.

I mentioned the syntax "(+ 1 1)" because you're trying to disqualify C++ homoiconicity on a superficial syntactic basis. If you can do that, then it is equally valid to say that LISP can't do simple addition.


No, I mean that it has nothing to do with compilation of strings. Homoiconicity means code is represented via data structures, so it can be manipulated with the language itself. C++ is not homoiconic.


You aren't calling them strings, but they are. I didn't specify "NUL-terminated ASCII" or anything like that. Call them S-expressions if you prefer. It makes no difference.

C++ can manipulate itself. Granted, you'll want a library such as LLVM, but you can get the job done yourself if you are a glutton for punishment.

Code is represented via data structures on normal (von Neumann) hardware. LISP is every bit as compiled as C++. Both forms of C++, human-readable and compiled, can be manipulated. It's the same as LISP, except that "human readable" is debatable for any form of LISP.


It's not the same and it's not represented as strings in Lisp, but I'm not going to commit further. You can read up on homoiconicity and Lisp on the internet, then you will see the difference.


OK, done. I read up on both. (and had earlier; I'm not unaware) Still I see no difference. There is none. Superficial syntactical differences do not matter, unless you'll agree that LISP can't do addition.

BTW, in LISP, actual usage of the homoiconicity is the surest way to make a mess of unmaintainable code.




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

Search: