13 ms·
A tool for thought
- n72 10y agoI hate to harp on this issue, but I tried Clojure for about a year on and off. I just couldn't get over the really crappy stack traces. I would break something and then spend 10 minutes tracking down whatever I broke. I'm happy with Kotlin for the moment, but would love to get back into Clojure if only it would get sane error messages.
- hashkb 10y agoIt's that "on and off" that killed you. Dig in, practice, get better, and it will become much less of a problem. Set your goal "I will get better at debugging" and not "I will immediately be a pro".
- hkjgkjy 10y agoI used to think so when I was new to Clojure. Then I realized that the stack traces just show you the call stack - nothing more, nothing less. I realized the thing that put me off was seeing Java stuff in the stack trace. But this is the beautiful thing of Clojures hosted nature. Clojure is just a library, that can be dropped into a project. Thinking about it like that made me appreciate the traces.
- agumonkey 10y agoEmacs cider repl added stacktrace filters that make you feel calm when something pops. I never did anything fancy but compared to vanilla stacktraces it's a great step.
- Myk267 10y agoYou're at least not alone. I used Clojure for a while and we didn't get along despite my attraction to the language, and the hype, I guess. Clojure makes a lot of trade offs to run how it does and where it does and those choices don't necessarily add up to the experience I, or others who seem to crop up here, prefer. While I haven't tried Kotlin, I'm aware of it and know that it isn't all that different from Scala, which is a bit more my style.
- cle 10y agoClojure is designed to be a practical language. Part of that is interop with the host VM (JVM in Clojure's case). The "crappy" stack traces are definitely NOT crappy when you're using Clojure in a complex JVM ecosystem. The raw-ness and simplicity of it is actually refreshing. The Clojure Java source is remarkably simple, and it doesn't take much time to get used to and appreciate the Java stack traces when writing non-trivial Clojure code in a Java world.
- n72 10y agoI just don't see how it's remarkably simple. In other langs with good stack traces I get exactly the error at exactly the line on which it occurred. In Clojure, I quite simply don't. I do absolutely love the rest of Clojure. I also realize there are tradeoffs to being hosted. Nevertheless, to deny that the fact that the stack traces aren't ideal seems a bit of a stretch.
- cle 10y agoI'm not claiming they're "ideal", which is a really loaded word. Just that they're practical, and in my opinion they make the right tradeoffs.
- conaws 10y agoSolving that is what this post is about
- hkjgkjy 10y agoI do Clojure and Clojurescript full time. Love the ideas, but we as a community need to step up our game when it comes to how easy and fun it is to get started. Setting up a Clojurescript project is even worse than "modern javascript". The only worthwhile way is using Martin Klepsch's "Tenzing" template, but using a template is not a solution. https://github.com/martinklepsch/tenzing https://github.com/martinklepsch/tenzing I worry about this since the power of Lisp and Clojure is how easy it is to experiment. Starting a C project is just doing a basic Makefile, a javascript project is just `npm init`.
- amelius 10y agoAlso fix clojure startup time please. I want to be able to run it like fast Unix style commands such as ls and grep.
- fnordsensei 10y agoTry Planck if you're on OS X: https://github.com/mfikes/planck https://github.com/mfikes/planck
- amelius 10y agoThanks, but i also need my applications to be portable :S
- fnordsensei 10y agoAlright, how about running it on Node then? I assume this is mostly for scripting, as long running servers and the like wouldn't need to be concerned with start-up times.
- amelius 10y agoThat might be a solution, yes. But Node is a single-threaded engine, so I'm not sure if I can run parts of Clojure which use multiple threads, or if there are other restrictions.
- pka 10y agoIt's interesting to observe how almost all mainstream dynamic languages move from "who needs types? types are very very bad and just get in the way!" to some sort of gradual typing or runtime type validation. * Javascript has Flow/TypeScript * Python has PEP 484 * Perl6 has some sort of types * Clojure/Script has core.typed, schema and now clojure.spec * Don't know about Ruby, but I've seen articles on type checking/annotations * Erland has Dialyzer (although this is not a recent development)
- dominotw 10y ago> Javascript has Flow/TypeScript This is not an example of language moving to gradual typing. Typescript is an entirely new language.
- protomyth 10y agoI have a bit of a theory on that, which I bet will be a bit unpopular but is based on some social things I have seen. A dynamic language gets popular[1]. As more people show up, they want to bring their way of doing things (e.g. "prototypes are stupid, we need classes") instead of fully adopting the language. Improvements are cool but some of the changes alter things in a fundamental way (e.g. dynamic to static). Sometimes it leads to second systems (e.g. Objective-C to Swift) and is often accompanied by "the need to grow up". Then we get a new language. 1) could actually be any language that doesn't fit the mainstream mold
- slowmovintarget 10y agoWhich is why what Rich Hickey did with clojure.spec is so important... He acknowledged the deficiency, but worked through it to understand what the problem actually is. Then he created a solution that solves the real problem, in a way that avoids diminishing the character of the language. Have a read through the rationale on the design of clojure.spec to see what I mean. http://clojure.org/about/spec http://clojure.org/about/spec
- agumonkey 10y agoThey're also converging on other features: - lexical closures - common set of base types (lists; dicts; sets) - literals for said types - immutability - generators - asynchrony Also from rust and golang, built-in "project lifecycle" with sane fs template, dependencies, build, deploy, test...
- draw_down 10y agoHmm, I wonder what all this means.
- deleted 10y ago[deleted]
- conaws 10y agoIt means you may soon have amazing error messages when working with Clojure. You'll also be able to write your code in such a way that it gives you amazing error messages when some part of it breaks.
- auvrw 10y agoi often like dnolen's blog posts for the links as much as the nominal content .. i thought "tools for thought was a dennet ref, but no, http://www.rheingold.com/texts/tft/ http://www.rheingold.com/texts/tft/ also, i'm now aware of https://github.com/ghcjs/ghcjs https://github.com/ghcjs/ghcjs although uncertain how to compare it to purescript..
- _mhr_ 10y agoI believe that "tools for thought" as a phrase comes from Ken Iverson's "Notation as a tool for thought" paper.
- makmanalp 10y agoAnother "tool for thought" essay, about J: www.jsoftware.com/papers/tot.htm
- jxy 10y agoI guess different people speak different languages and have different tools of thought.
- agentultra 10y agoI appreciate what clojure.spec is trying to do and think it's a good step! If this kind of thing interests you though I suggest looking beyond the code and learn the mathematics -- logic, predicate calculus, and the ideas behind formal methods! It's a wonderful tool for thinking and well worth encouraging. Try looking up TLA+, Event B, Unity, etc, etc. They've been working on some neat maths and the tooling around it these days is amazing! For more hybrid language/spec approaches Agda and Idris are super fascinating.
- conaws 10y ago"In my humble opinion clojure.spec is the most VPRI-worthy feature Rich Hickey has shipped since delivering fast persistent data structures." Love this quote
- conaws 10y agoThe fact that folks in the comments are complaining here about Clojure's error messages here tells me that the implications of this post might not be obvious. Up to this point, it has been really really hard to give good error messages from macros, and a lot of the core functionality of Clojure (let, defn etc etc) are from macros. What Clojure.spec means (if I'm correct) is that in the future, not only will the Clojure language itself be able to have sane error messages, you'll be able to easily create sane error messages for yourself from your own code. This is a HUGE HUGE deal. It is quite possibly BETTER than any type system. http://clojure.org/about/spec http://clojure.org/about/spec Also, the idea that you'll be able to get generative testing FOR FREE, is just totally insane.