45 comments

[ 3.4 ms ] story [ 107 ms ] thread
hehe, it really confuses github language detector, Github: it looks like PASCAL to me.

This repo should become a testcase

Here is coffeescript example:

    hello = ->
        alert "Hello, world!"
    hello()
Why complicate things?
(comment deleted)
I don't know coffeescript, but "= ->" looks like one token too many already - why complicate things indeed.
It creates a thunk so that alert is called as a result of calling `main` instead of as a result of defining it.
+1 why complicate things

    console.log 'hello world'
(comment deleted)
The c example uses puts(). I was a little surprised as this is not the typical version I have seen.
Also, the Racket example starts a web server with an html "hello world" page, which is unlike the other lisp-based examples.

edit: my pull request with a fix was accepted

Which language required the most lines of code?
git clone https://github.com/Prithvirajbilla/helloworld && wc -l helloworld/* | sort
What's the output? (For people like me who don't have access to a git client right now)

     30 helloworld/whitespace
     59 helloworld/shakespeare.shakespeare
     65 helloworld/chef.chef
     25 helloworld/omgrofl.omgrofl
     20 helloworld/delphi.pas
     22 helloworld/x86.asm

Copy pasted some of the biggest ones.
At least "sort -n", but yeah.

This is top five:

     20 helloworld/delphi.pas
     25 helloworld/omgrofl.omgrofl
     30 helloworld/whitespace
     59 helloworld/shakespeare.shakespeare
     65 helloworld/chef.chef
My wc right-aligned the line counts, and it looks like yours does too - so no -n required.
With and without "-n" produced different results for me.
Interesting. Seems this is a recent GNUism, where -b (strip leading blanks) is implied although not stated so in the manpage. I see this in "sort (GNU coreutils) 8.13" but not in "sort (GNU coreutils) 5.93" or BSD sort.
And it still surprises me there are new languages where 'hello world' is more complicated than:

    print('hello world')
Dart, which was released two years ago, after JavaScript had been around for two decades and ASI was still considered an issue, still required a semicolon after each statement.

I half feel like pulling out an AST and doing a ModernDart, getting rid of all the redundant tokens and compiling to the } } } } } language we all know and ignore.

Why does this surprise you? The goal of most languages isn't to have a very terse way of writing a program that does nothing but print "hello world".
One of the goals of language development is to avoid errors.

Redundancy leads to inconsistencies and is thus poor design. DRY applies to syntax too.

What I'm saying is I don't see a language where hello world is

    module Main
    
    main = println "Hello World"
as inferior to a language where it is

    println "Hello World"
simply because of that. That's a particularly superficial way of looking at languages.
I don't either. It's an important consideration, but not the only one.
Ambiguity also leads to inconsistencies, and I'm sure you are aware of the ambiguities of ASI
The ambiguity of ASI is that it is optional.

If there's one way to end a line, then it's used, the line is ended. Nobody in Python or Coffeescript-land misses an additional way to do this.

You need redundancies in language design. Otherwise, you'd never have a syntax error because every possible input would be valid.
There's nothing stopping one from having a non-redundant syntax. Multiple ways to end a line, or mark a block, aren't required to make a language work.
I'm guessing a non-redundant syntax would be very inconvenient to work with for human programmers, in a similar way to how machine code was (not that people can't work in machine code, just that most prefer not to). Also, redundancy is not the only cause of errors, and trying to enforce it might actually make other classes more likely; consider forcing single-statement blocks to not be enclosed with braces.
> I'm guessing a non-redundant syntax would be very inconvenient to work with for human programmers

Python or Coffeescript are fairly non redundant, ask their developers how inconvenient they find it. The parts people tend to complain about, and screw up on, are the few remaining redundant bits, eg,

    SyntaxError: invalid syntax 
Because:

    if somecondition
Rather than

    if somecondition:
Its on the home row; I don't think people use enough semicolons.
I would have liked to see something more substantial. As it stands (and I'm sorry, I mean no disrespect..), this is quite worthless. I'll spend 30 seconds clicking around random ones and then leaving.
This is pretty cool. Helloworld isn't the best way to judge how high-level a language is, right? From what I understood, CoffeeScript is supposed to improve Javascript's readability, but JavaScript had a much simpler Helloworld program.

It would be cool to see something like this but tiered by some kind of language evolution (group all the Lisps, all the Javascript-functionality languages, the C's, etc).

Helloworld was historically more like a way to make sure your dev environment was setup right (libraries on the path, compiler actually installed). It's short pulls in a library and produces visible results. That's why it was always the intro example not because it was in any way a valid tour of the language.
What's weird is that the coffeescript and javascript versions do slightly different things.
well the coffeescript and javascript versions behave differently. The coffeescript is the equivalent of

    var hello = function() {document.write("Hello World")}; hello(); 
while the javascript is the equivalent of

    document.write "Hello World"