in reply to Re: Proving that Perl influenced JavaScript for WP
in thread Proving that Perl influenced JavaScript for WP
The claimed functional influence from Scheme is already present in Perl5. ( sub returns a function reference, making functions a first class object which can be treated like variables)
Block scoping was later introduced into JS with let . ( var is a mess )
The operators you list derive from C, a common predecessor for Perl and Java.
Actually "typecasting" in JS is a major problem, JS has no "scalars".
To better explain, there are two major ways to do dynamic typing.
Like in Python where 3/2 is 1.
Why? Because 3 and 2 are integers. (Python introduced something like // later to address the confusion)
Like in Perl where 3/2 is 1.5 and 3 . 2 is 32
and the rules how + behaves confuse(d) the shit out of people.
You can remember that 1 + "1" is "11", but what will happen if you don't have full control about the types in the variables of a + b ?
JS programmers must resort to tricks like
'a+b+0' or 'a+b+""'
(IIRC, this depends on precedence and I have to look it up to be sure UPDATE guess what, I got it wrong, have to correct this later.
What's sure is that a+=0 becomes a number and a+="" a string )
Perl fixed this with a lot of operators, but people complain that the code looks unreadable, because of all the symbols.
But Brendan had 10 days to design the language which had to look like Java...
They fixed a lot of stuff in the meantime and introduced some nice python features.
But it's still annoying not to have pure hashes in JS ...
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
---|