Re:A tool for thought
by swannodette on Saturday June 04, 2016 @10:10AM
(#11836375)
Compiling trivial programs with ClojureScript is equally trivial:
java -cp cljs.jar clojure.main -e '(require (quote [cljs.build.api :as b])) (b/build (quote [(ns foo) (js/console.log "Hello world!")]) {:optimizations :advanced})'
But I'm not sure this is actually telling us anything.I think comparing the compilation of a C hello world program to a web-project, with inbuilt test scaffolding, serving of generated content, communication across a network and safe multi-threading of the network stack is a little bit of a mismatch. If you build a C project with all of that in it, I think that it would be a bit more than a 1 liner, and it would take a little while longer to compile. Sure not as long as the clojure project to compile but not 3 milliseconds.
I'm sure everybody knows this, but here's "hello world" on the command line using GCC in e.g. Linux:
The most complicated thing here is probably the bash quoting/escaping (which explains the double backslash inside printf()'s arguments).The above command line spawns two processes, one of which is a full C compiler, and it runs in 3 milliseconds on my embarassingly old home laptop (Core-I5 M480 at 2.7 GHz).
I'm not trying to be the old fart claiming that everything was better back in the day, but this (to me) almost makes C seem as approachable as BASIC on the old 8-bit machines, when looking at the relative complexity.