Well, I like programming language comparisons, so how could I resist this chart (via) promoting the simplicity of the io language by pointing out how few keywords it has. The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords. Perhaps that reflects Java’s heritage as a simplification of C++ (63 keywords) and PHP’s heritage as an amplification of C (37 keywords) toward a specific purpose? As usual, Perl is the poster child for language complexity. Ruby does well with 40 keywords. But, before the Ruby fans get too uppity about the simplicity of their language, they should contemplate the cat walked across the keyboard while I was holding down the shift key predefined variables that they inherited from Perl.
The number of keywords is by no means a good metric for the simplicity of programming languages. PHP just has 53 keywords, fine, but what about the more than 5.000 built-in functions with their inconsistent names? Perl’s sort statement does the same as all the sort, ksort, rsort, asort, ursort functions in PHP. And where is the deeper distinction between a keyword and a built-in function? There is none. So this metric makes no sense.
I guess the Whitespace language, having just 3 keywords – space, tab and newline – is one of the most simple ones in existance. Brainfuck, having 8 keywords, comes close and both are so much simpler than PHP
Jeff Moore’s Blog: Keywords and Language Simplicity
[...] Moore has posted and shared an interesting graph showing something I’d never thought about comparing one [...]
What about assembler? Does it seems to be a simple language?
i agree with Stefan . Java libriry have tousands of ready to use functions and classes. if you look for simlicity check prolog (logical prog. lang.) and haskell (functional prog. lang.).
Maybe it is the other way round. If you have many predefined and built-in functions it is easier to work with the language.
@Stefan
If by “built in function” you mean “a primitive” then yes there is most certainly a difference. A keyword is something defined in the language they may work under different rules then the language normally does.
A primitive is just an ordinary function that happens to be implemented in another language as an optimization (e.g. we had a function for doing PGP encryption but it ran too slow so we coded it in C and provide a primitive for it).
Here is (one in a million) an example of a PHP builtin function: apache_request_headers(). And what we see there – a function, that is available only, if we are running PHP as an apache module. In another case – we need to parse _SERVER variable. Its a really weird way to work with HTTP in a language, that is made to work in a WEB environment. Even having a special function – PHP doesn’t make it simple
Another example is the “SimpleXML” class…really simple functionality but not simple to use…:-(
If you have many predefined and built-in functions it is easier to work with the language.
PHP lies about it’s keywords. If you try:
true = 22;
You’ll receive a syntax error. Same with false and null.