Hacker Newsnew | comments | show | ask | jobs | submit login

I think the issue with single-pass compilation is that you can't have a function a in namespace A call a function b in namespace B which in turn calls a, unless you've first done a forward declaration of the var(s). I can't see how the hell 2-pass compilation can be reconciled with Clojure's macro system; either Steve or I have not thought this one through. Personally, I've run into this once [1] and it was easy to resolve with an

  (ns OTHER-NAMESPACE) 
  (def missing-function)
At the top of the file. I'm used to worse than that from other languages, mind. (cough C++ cough)

I don't get what the fuss is about, either. The debugger is pretty much the only suggestion I like - I've used JSwat with Clojure and it's not very pleasant. Obviously some kind of continuation-based debugging facility would be nice, but it's basically not going to happen because of the JVM, not because Rich Hickey is an Evil Bastard (he's not). Either way, a usable debugger will materialise sooner or later, Yegge-tantrum or not.

I think Clojure is being managed very well. I admittedly haven't followed the community for a while; the mailing list got a bit too high traffic for me, and I can't use the JVM for most of my projects. But whenever I am using Clojure and have a problem, it's usually because I haven't found the right bit in the docs, or because I missed/misunderstood a major feature that was added recently, or because the functional style sometimes is just a bit beyond the capabilities of my brain. (I'll write the code in imperative style, then translate it to functional, and usually learn something in the process; done) I don't see that as a failing of the language, but my inexperience with it. Doing simple things with it is simple.

I have a theory, though. Yegge talks about porting Java code to Clojure. I think that's the problem right there. Sure, if you're porting line-by-line, it's not going to be especially nice. It's a bit like translating German to English sentence-by-sentence. Most of the time it works, despite sounding a bit stilted. But sometimes there isn't a direct equivalent, and you have to change the surrounding sentences. The structure of your average Java program is so wildly different of your average Clojure program, no wonder it doesn't port directly.

[1] Okay, I'm not massively experienced with Clojure. I've written maybe a few tens of thousands of LOC of it, and no really big projects.




I can relate to the debugging part. Useless stack traces have been the reason I simply gave up on Clojure.

-----


I wouldn't call them useless, but I guess I'm used to C++, or worse, just a hex stack dump (yay, game consoles). Clojure mangles names somewhat to make them Java-compatible; you can easily do the reverse translation in your head. Still, this could be automated rather easily.

-----


As far as I remember clojure just spit out "This is not a function" or something like that, without any indication where the error occured.

There is a trace macro but it doesn't provide complete traces without explicitly adding every function you want to trace, which becomes tricky very soon. Manual tracing with printf()s like in non-functional languages isn't built-in either. There are half-baked macros for this on blogs if you google hard enough, but that is not the kind of thing that leaves a solid impression of a language.

Maybe I was just working in a non-clojuresque way.

-----


I agree its a problem. I use the repl a lot and bild up the functions and debug with prints witch is ok because you can print anything (not like in VB). I know that they are working on it so I hope it will get better.

For me, however, its not a reason to quit.

-----


I have been working on a fork of Clojure off-and-on that tries to improve the debugging experience (https://github.com/qbg/clojure). How do you think the stack traces could be improved?

-----


Suppose you accidentally put an extra pair of braces deeply inside a function. The message you'll get is something like "could not cast to function" without any meaningful information where this happened.

-----


This is one example of how to remove uninteresting stack frames from Clojure stack traces. http://j.mp/h3xzdN

-----


http://mmcgrana.github.com/2010/03/clojure-setup.html

http://clojure-log.n01se.net/date/2010-12-09.html#09:53

http://dev.clojure.org/display/design/Stacktraces

http://groups.google.com/group/clojure/browse_frm/thread/5b1...

http://dev.clojure.org/jira/browse/CLJ-733

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: