

Ask HN: Why isn't there a single universal syntax for all programming languages? - piyushsinha

Why isn&#x27;t there a single universal syntax for all programming languages ? Why can&#x27;t the syntax for writing code be the same across all of them ?
======
jacquesm
Different languages express different ideas of how their creators think
programmers should express themselves.

Since programming languages evolve this tends to cause the syntax to evolve
along with the languages.

There are several languages that can be considered the great-grand-parents of
pretty much all the languages still in use today.

Here is a simplified diagram:

[http://rigaux.org/language-study/diagram-
light.png](http://rigaux.org/language-study/diagram-light.png)

Every step along one of the edges solved some problems and probably created a
few new ones too. The syntax was adapted to deal with the new requirements.

So that's why the syntax for different programming languages can't be the
same, if it were we would essentially have only one programming language.

And if we did tomorrow morning someone would come up with a variation to
improve on some issue...

~~~
TimWolla
There really is an arrow from Java to JavaScript? Java is like JavaScript as
ham is like an hamster.

~~~
jacquesm
That's mostly because of a bunch of names for functions. JavaScript has more
in common (syntax wise) with C than with Java.

~~~
nanofortnight
Javascript actually feels more like it's Scheme-inspired. The object system is
clearly from Self though. And the syntax is from C.

~~~
jacquesm
You're spot on. The wikipedia page has this to say on that subject:

"The key design principles within JavaScript are taken from the Self and
Scheme programming languages."

~~~
auganov
Bernard Eich (creator of JavaScript):"The immediate concern at Netscape was it
must look like Java. People have done Algol-like syntaxes for Lisp but I
didn't have time to take a Scheme core so I ended up doing it all directly and
that meant I could make the same mistakes that others made."

[http://books.google.pl/books?id=nneBa6-mWfgC&lpg=PP1&pg=PA14...](http://books.google.pl/books?id=nneBa6-mWfgC&lpg=PP1&pg=PA141#v=onepage&q&f=false)

------
wikwocket
This is like asking why there isn't one universal language for human speech.
Both are due to long storied histories involving many different groups of
people, trying to do very different things, and achieving something which
meets their needs and is becomes very established.

Having One True Language/Syntax may be interesting to think about, and could
theoretically make things much more efficient, but you'd never be able to get
people to agree on things (we can't even agree on the "proper" way to do
braces), the transition would be an impossible nightmare, and the end result
could be something which is good for many tasks but excellent at none.

------
wmf
Because people don't agree what that syntax should be. Also, different
language semantics lend themselves to different syntax.

