

A syntax comparison across many languages - Rickasaurus
http://rigaux.org/language-study/syntax-across-languages.html

======
dsr_
Eleven ways to comment to the end of the line; five of them used only by one
language each.

~~~
jonathansizz
And the most common way is one of the worst (most inconvenient), although J
seems to win the prize.

~~~
gebe
Well, depends on your layout. That might be the case on a US keyboard but for
many others (for example German, Spanish, the Nordic countries' layout and
many other European and non-European layouts) it would be preferred over for
example "//". For "//" you need to use a modifier (just as with '#') but you
need to stretch more (or use both hands) and as well tap it two times. That's
one of the reasons why I prefer to code using an English layout in my
IDE/editor :)

------
perlgeek
Also relevant: <http://rosettacode.org/wiki/Main_Page> Some parts are about
language features, others are about implementations of algorithms in many
languages.

------
jhrobert
This is quite an amazing achievement.

There are a few other dimension to explore beside syntax. Like "are arrays 0
or 1 based?" etc

Apparently the author is now part of the opalang effort. They used to have a
slightly weird syntax for their language and later changed that to have it
look more like JavaScript. That's a strange move when concise syntaxes à la
Ruby or CoffeeScript seem popular.

------
CanSpice
I haven't looked at everything, but the Perl variable identifier regexp is
incorrect, as Unicode characters are allowed as of 5.12, which was released in
2010. For that matter, same goes for Java, except Unicode letters are allowed.

~~~
hythloday
Java also allows currency symbols (e.g. £€$) as identifiers.

I know this because I had a colleague who was quite proud of having switched
to Dvorak, and another colleague who immediately wrote a code-generation tool
that emitted € characters in variable names...which are untypeable on a Dvorak
keyboard. :)

~~~
emmelaich
Java allows a vast array of odd characters, including nulls.

[http://stackoverflow.com/questions/4838507/why-does-java-
all...](http://stackoverflow.com/questions/4838507/why-does-java-allow-
control-characters-in-its-identifiers)

------
brittohalloran
My big takeaway is that Ruby generally does things the "most-popular" way, and
that maybe a lot of those obscure languages are obscure for a reason
(object["method"](params) to invoke a method?!?)

~~~
ajanuary
You mean like JavaScript? Not sure why it's not listed there next to Pike.

    
    
        var f = []
        f['push'](2)
        // f -> [2]
    

Pike also has the more familiar object->method(params) syntax.

It's actually a pretty useful bit of syntax. I've been using it recently when
combining multiple objects deserialised from json.

    
    
        var report = [name, dob]
        var person = { name: 'Andrew', dob: '1980/03/23' }
        _.each(report, function(prop) {
            console.log(person[prop])
        }

~~~
wilmoore
Good call...and for those not necessarily using something underscore.js-like
(thought almost always nice-to-have):

    
    
      var report = ['name', 'dob'];
      var person = { name: 'Andrew', dob: '1980/03/23' };
    
      report.forEach(function(prop){
        console.log(person[prop]);
      });

------
splicer
This glosses over some important syntactic differences. For instance, a
semicolon is used differently in C than it is in Pascal. In C, it's a
terminator; in Pascal, it's a separator.

------
mbell
What is "Assembler"? Is that supposed to mean assembly? If so what
architecture uses '!' as a line comment token?

~~~
heretohelp
Not an architecture, an assembler.

~~~
mbell
Fair enough, my underlying point is that `assembly` isn't a language, it's a
family of languages which have a set of characteristics which are tied very
tightly to the instruction set used (often called an architecture). Comments
would be a characteristic of the compiler, which you may call an 'assembler'
if you wish, however an assembler is not a language.

~~~
heretohelp
An assembler is a utility with its own dialect regardless of target hardware.

------
ret
#if 0 ... #endif in C/C++ is not a true comment -- commented text is parsed by
preprocessor.

------
astrodust
If there was ever a project that required an _emergency typographer_ , this
would be one. That's a terrible presentation for a lot of great information.

------
haberman
Oh poor XSLT. I can't decide whether to laugh or cry.

------
timaelliott
<http://hyperpolyglot.org/scripting> is a similiar resource for php, perl,
python and ruby only.

~~~
oconnor0
<http://hyperpolyglot.org/> provides comparisons between various "families" of
languages - not just the above. But there isn't a comparison between, say,
Ruby and Haskell.

