| I think I'm in agreement with you. What I meant by the IDE is that "ideally" it should have REPL like offerings if the language can support hot code swapping. I still don't think its REPL that makes Lisp or clojure magic (when I say magic I mean awesome). Its all the other stuff like macros and homoiconicity (which I see your point plays some part in academic REPL). > Even JRebel can not do to a running JVM application what some Lisp implementations can do. Not near of that. Well thats because of the Java compiler and in some parts the language of Java. It has nothing to do with the JVM otherwise Clojure wouldn't work. But I agree JRebel is far cry from the full reloading capabilities of Lisp, Erlang and other dynamic languages. > IDE with a powerful debugger will let you evaluate expressions based on a state that is stuck... ie setting breakpoint (as well of course as investigating current variables and such) > This is pretty basic I agree but its still surprising how many languages do not do this well and I didn't mention that you can execute simple expressions in that mode something other static languages like C will not allow. Besides.... I can change a function name in Java or Scala and see immediately everywhere in my code base with (e.g. red squiggle lines) how that impacts other code... for static languages that is pretty basic :P I'm totally envious of your lisp machine (EDIT: in all honesty...I realize that originally sounded sarcastic). |
Clojure is constrained by the JVM and its implementation. Though Java is even more constrained.
You get a mini Common Lisp Object System demo in the LispWorks REPL:
We define a class person with a slot 'name':
Let's create a list of persons: Let's define a custom print method: How does a person print now? Let's add a slot to the class, a slot 'age': Let's update the print method: Woops: all persons now have already got the new slot: Let's set the new slot: Let's define a new class: social-security-mixin: Let's add this new class to the superclasses of PERSON. Now we do something really wild: we write an around method for printing: We redefine the original method just to print the name and age of the person. Then we define an AFTER method for the social-security-mixin class: Now we set the social security number of the persons. Wait? Lisp has updated my objects, since I added a new superclass to their class? All objects now have a changed superclass for their class? They inherit the new slot?And the print-method gets reassembled for the new inheritance tree and the changed set of methods?
As you see the objects have a SSN and the print methods are dynamically combined. For the person it runs the around method, then the primary method of person and then the after method of the mixin. If I'd now change the inheritance tree, then the methods would be recombined according to the inheritance at runtime... I could also dispatch on the second argument...CLOS supports multi-dispatch over multiple-inheritance with dynamic combinations of applicable methods.
CLOS can do quite a bit more than that...
Java can't do anything like that.
It can't update objects on class changes/inheritance changes/...
It can't combine methods based on the multiple-inheritance class tree.
It can't change the class of objects. It can't reprogram the object system itself. See the CLOS MOP...