Hacker News new | ask | show | jobs
by bxh 3796 days ago
What language would you suggest is friendlier, and less rife with gotchas? I find the rules of C fairly reasonable, at least on the surface.
4 comments

In no particular order any of the following as an introductory language.

Ruby -- puts "Hello World"

Python -- print "Hello World"

Lua -- print("Hello World")

Personally I wish every programmer would eventually learn C. Getting down to that low level and really understanding how things work is important, but if it is the first language I think we would end up with a whole lot less programmers as many would give up early.

Ruby is written in C

Python is written in C

Lua is written in C

I'm not sure how that is pertinent. Programming languages as a general rule are initially implemented in some other programming language and then potentially later bootstrapped with their own language.

Ruby has also been implemented in Java (JRuby), Ruby (Rubinius), .NET (IronRuby), JavaScript (Opal).

Python in Java (Jython) and .NET (IronPython)

Lua has been implemented in too many language for me to list them all here (C, C++, Lua, JavaScript, Erlang, OCaml, Go, etc...)

It seems C itself was initially bootstrapped from B which was bootstrapped from BCPL. If we were to follow this to it's logical conclusion I'm guessing we end up at some version of Assembly. Are you suggesting we should start budding programmers on Assembly?

No. Just stick with C so that it's portable and fast.
I don't write Python in C /s

You meant Ruby, Python and Lua have their reference implementations written in C. They all also have other implementations written in other languages.

That's what I meant. Most important programs are written in C. Look at what program you are running now. See if you can find the standard C library it links to.
#include <stdio.h> int main(void) { (printf)("C is awesome\n"); return 0; }
#include <stdio.h>

int main(void) {

  (* * * * * * * * * * * * * * * * * * * * printf)("C is awesome\n");

  return 0;

}
In C99:

    #include <stdio.h>

    int main(void) {
        (* * & * * * * * & * * * * * * * * * * * * * printf)(&1["C is awesome\n"]-3/2);
    }
I proudly display my "Best Abuse of the Rules" category win of the Int'l Obfuscated C Coding Contest on my resume.
The drop from Pascal to 'C' is pretty short.