Re:Shall We Use Clojure?
by tylerhobbs on Monday July 02, 2012 @11:02PM
(#4192294)
We have been using Clojure for a product for about 9 months now, and in my experience, I have no trouble identifying what different blocks of code do. It may depend on proper syntax highlighting, but I think one of the keys is that there is so little boilerplate in Clojure that all of the code is important. You're not skimming over getters and setters, assignment of constructor parameters to the object, or some of the other things your eyes tend to automatically skip when reading, say, Java or Python. It tends to be pure logic or pure data, with very little else in the way.
The problem is that you don't have cues about what you're looking for. Keywords and actual syntax give a lot of those cues.
These seem like standard criticisms of lisps that have been raised for decades. I dont know the responses or solutions, but surely they exist in abundance on the interwebs.
Re:Shall We Use Clojure?
by weavejester on Tuesday July 03, 2012 @04:48AM
(#4193160)
I'd venture to say that it's only hard because you're not used to it. When I look at Clojure source code I don't find it at all difficult to read.
In fact, now that I think about it, I don't think there's any language I'd prefer to read over Clojure.
Aha! I just had a really good idea! Let's call it "Clojure folding". It's like code-folding only instead of hiding lines, you pull up all the code into one line. Some of the internals may be elided - and revealed with a tooltip.
I also like the idea of coloring the entire content of the parens, so that you can embed a large item and then clearly see that you are now back in the containing list. Indentation doesn't do a good enough job, nor do rainbow parens. Further, you'd get a good intuitive sense of place in the code if you have a consistent series of colors. Emotionally, you'd know that if you're typing read you're like 6 layers deep - and that's really deep, in the danger zone, and you probably want to pull some stuff out into definitions.
Chris Granger, feel free to include these ideas in Light Table.