Lasse Reichstein Nielsen <> writes:
> Prisoner at War <> writes:
>
>> Not to get into a programmers' rugby scrum over favorite languages
>> here, but how's JavaScript "more powerful" than Java???
>
> How do you measure "power" of a programming language at all?
>
> There is "computational power", but both are Turing-complete, so that's
> moot.
>
> There is "expressive power": How easy do you express what you mean?
> I.e., how short, but still readable, can you express the solution
> to a problem.
That's the "power" I meant.
> I can't say which one wins here. Closures in Javascript and classes in
> Java are both good at this. The greater standard library of Java
> increases the expressive power whe dealing with non-trivial
> algorithms, by introducing more "primitives", but Java is more verbose
> too.
And not only is java more verbose by default, it's also impossible
(without a preprocessor or custom compiler, but that would be cheating)
to decrease its verbosity in certain key areas. I'm thinking especially
about closures - java doesn't (yet?) have them, and you have to emulate
them via instances of explicitly defined custom classes. On the other
hand, it's relatively easy to mimic classes in javascript with syntax
that's probably just a bit less verbose than java's (without going into
the general merit of doing so).
Al said though, I still think javascript is much more verbose than it
could have been.
> Any other powers?
Dynamic typing is a bit win usually. Especially combined with some sort
of OO system. OTOH, having an overly static and explicit type system
definitely helps with static analisys tools (think code completion).
J.
--
Joost Diepenmaat | blog:
http://joost.zeekat.nl/ | work:
http://zeekat.nl/