in reply to Re: A comparison of Perl vs. JavaScript -- a reference table.
in thread A comparison of Perl vs. JavaScript -- a reference table.

Perl was the scripting language back then, and Brendan Eich admitted once that he was strongly influenced by Perl (that interview is hard to find now). This influence is more than obvious if you look at the Array methods.

The story goes (IIRC):

He was initially hired to write a Scheme like dialect. Many applications had embedded Lisp engines, like Emacs, AutoCad, Gimp,...

But Netscape made a deal with Sun, and he was told to design something that looks syntactically like Java.

As you mentioned , are strings one important difference, because they are immutable in JS, while in Perl they are a piece of memory at your free disposal.

The lack of pure hashes is (or was?) a big problem in JS.

There are some other issues, but for me is 90% of JS just a mini Perl with Java syntax.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^2: A comparison of Perl vs. JavaScript -- a reference table.

Replies are listed 'Best First'.
Re^3: A comparison of Perl vs. JavaScript -- a reference table.
by choroba (Archbishop) on Dec 15, 2020 at 17:28 UTC
    I heard him tell the story at CurryOn 2015 in Prague. IIRC, he was not only hired to write a Scheme like dialect, but he actually wrote it that way. When he was almost done like a week before the contract end, they asked him to change the syntax to be more Java-like.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Did he mention Perl?

      I'm also asking because Perl lacks Lisp'ish macros - pretty much like JS does.

      OTOH is his regex syntax based on Perl 4, so he probably didn't know Perl 5 and features like private vars, anonymous subs and closures, are just a Co evolution.

      ( not sure if typecasting of primitive types is Lisp'ish, elisp is no good role model)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        He didn't. In fact, no one at the conference did :-( But I was able to submit some patches to a Perl project during a boring presentation.

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]