3 ms·
As an (embedded at the moment, but I've been around) C and sometimes C++ developer, considering that tree to be "easy" just seems absurd. I'm sure everybody kn
by unwind 10y ago
As an (embedded at the moment, but I've been around) C and sometimes C++ developer, considering that tree to be "easy" just seems absurd.
I'm sure everybody knows this, but here's "hello world" on the command line using GCC in e.g. Linux:
$ echo -e '#include <stdio.h>\nint main(void) { printf("hello, world!\\n"); return 0; }' > hello.c && gcc -o hello hello.c && ./hello
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.
- pathsjs 10y agoExcept when you want to add a dependency. Then things will not look nearly that simple...
- swannodette 10y agoCompiling 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.
- mlakewood 10y agoI 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.