Hacker News new | ask | show | jobs
by optionalparens 3446 days ago
I don't understand what you are getting at here, can you explain more? How is an interpreted language turned into something compiled? It sounds more like you have an issue with heavy weight frameworks, which I can agree with, but I am not sure if this is what you are really trying to say. I also agree that feedback loops and debugging trails are important.

Clojurescript tends to do well with 2 of the 3 you listed. Feedback loops are quick with hot code reloading, side-by-side development, browser tools integrations (ex: with chrome dev tools) and so on. The Clojure/Clojurescript REPL itself is probably one of the best feedback loops I can think of that I've used other than proper Lisp machines or good Smalltalk images. Add in working with a data-oriented approach cljs encourages and using immutable data structures, EDN, transit, and things like that, and again things are a fast feedback loop predictable, and easy to debug.

The actual debug trails however in Clojure and Clojurescript leave much to be desired but are getting better. I personally haven't had many issues but I grew up on assembler, Lisp, C, C++, and that kind of stuff. After a few days, most of the more obscure things are at least predictable and you understand what they are. Given you can attach with a debugger from Emacs, Intellij, Vim, etc. it's even easier to figure out what's going on. Clojurescript and Clojure tend to discourage big monolithic things that aren't composable via the standard library, 3rd party libraries, and language design. You simply will shoot yourself in the foot if you start creating giant framework blobs and things that can't compose, so to me that's a good thing. For instance, using things like map, reduce, cat, transduce, apply, update, etc. become infinitely harder. Of course like any language, anyone can still do dumb stuff but it's nice that things are pretty simple from the functional point of view that common sense hopefully sets off alarm bells for people.

Anyway, Clojurescript in general for me is a superior experience compared to the old days when I messed around with Perl, CGI scripts, PHP, ASP classic (COM+ add-ons!), and so on to get a dynamic website going for something. Refresh, print line, and approaches like that are and have always been garbage. I've never had better visibility into an app than with Clojurescript, and given that most things are idempotent and pure that I write where possible, testing is also even easier. In most SPA frameworks in Clojurescript, you also have a single source of truth and visibility into it is as simple as running a built-in function to grab a map key or just printing the map if you want the old school approach.

1 comments

I have nothing against clojurescript. I was making a general point and agreeing with the author. His approach is the right one when compared to what is required to "compile" one form of javascript into another form of javascript and then "link" it with some monolithic framework.

That is the state of affairs that upsets me. Each framework and toolset in the js ecosystem is basically a virtual machine with its own idiosyncrasies and incompatible bytecode that doesn't interoperate with anything else in the js ecosystem.

Clojurescript commits some of the same sins but at this point things are too far along and diveristy in general is not necessarily a bad thing. I just wish the debugging experience was better and the tooling was a bit more standardized so I wouldn't have to relearn everything every time I wanted to try another flavor of js.

Oh didn't think you had anything against Clojurescript, just maybe pro-old school PHP ways or something.

I've been a bit spoiled by ClojureScript and I can't imagine using much else as far as js tooling. I'm less familiar with Elixir and some other newer options. I've only played with Elixir a bit and not used it on a real deployed project, but some people like the experience of that too. For me what puts Clojurescript over the top is it brings most of the sane things about Clojure and allows me to write JavaScript essentially in a sane way. It also does so without stopping me from being able to use JS libraries when I absolutely have no choice. The isomorphic code potential is just a side benefit - most of the time I can just take a Clojure file and rename it cljs or cljc and it just works as long as I'm not doing anything obviously pure Java there.

I agree Clojurescript commits some of the same sins. As far as tooling, I feel at least Clojurescript's is pretty standardized. I agree there are too many ways of doing the same things out there. JavaScript in my eyes is a terrible language that needs to be taken out back and shot - faster VMs and the browser are not an excuse - the browser itself is in a similar position, but that's another discussion. I've been programming a long time and I've been exposed to some pretty terrible things so I don't say that lightly. JavaScript is doubly awful in the browser. And yes, I get it and am aware of the new enhancements to the language long overdue. Clojurescript is the best current compromise for me, but like anything, I'm happy to use something else if it makes sense.

I'd still advise everyone to be wary and there's no one size fits all. In the past, I tried things like GWT and various approaches in .NET to transpiling and found them lacking or inferior, but I understand they work great for some people. Clojurescript is the first time I've found a happy medium, but it's not for the inexperienced programmer. Some people complain about the barriers to entry, but I'm somewhat glad they are there. Trying not to sound like a get off my lawn guy or an elitist, but I'll say that learning a language and to program in general is best first before trying to do things like networked service i.e. web and mobile apps. I understand people sometimes need immediate gratification and feedback, but it's also why we have so much trash just put out there - it's so easy and people who don't really know how to program often speak the loudest. Patience to learn and overcoming adversity are really valuable skills for programmers. For as many steps we've taken forward, there are so many back.

Clojurescript is a good compromise for me. The signal to noise ratio is a bit better vs. other JS-related offerings for now. I don't feel like we should always chase the lowest common denominator, and I wish people would stop the TLDR approach to programming. To that end, I feel being responsive and positive when interacting with new-comers to programming, and not trying to proselytize <insert your favorite one true way> to everyone is a better approach. Moreover, writing good documentation, organizing things cleanly, and so on is valuable to helping people get off the ground easier. I think we've reached a bit of an age where people want to fly the plane before learning what flaps or a landing gear are. I'm all for helping people, just the right way.

So from that point of view, I do somewhat disagree with part of the article's implied premise of wanting to be friendly to non-programmers with regard to Clojurescript. I've heard this promise so many times, from Visual Basic to Smalltalk to Visual Development Environments to various Web Apps - let's just do better with what we have and focus on taking some risks to replace the bad stuff we're so attached to rather than trying to make everyone into a programmer. Many better choices out there and I can't really see Clojurescript itself as being too friendly to non-programmers. I'm also not a believer in free lunches. But what do I know, I'm just another guy that learned the old way with pencil and paper and believes in learning concepts more than syntax.