
JavaScript is the new Perl - jamesli
http://ocpsoft.org/opensource/javascript-is-the-new-perl/
======
reissbaker
Perl never had a monopoly on a runtime environment with an install base of
pretty much everyone who owns a computer, tablet, or smartphone. Sometimes
it's not about engineering principles.

If native mobile apps end up de facto replacing the open internet, that could
change, of course. But I hope the internet remains, warts and all. And as ARM
chips improve, and DOM APIs are expanded, and JS engines become more
efficient, and the HTTP spec is ever more optimized for web applications, I
think in the end the browser will survive.

~~~
marrs

        >> Perl never had a monopoly on a runtime environment with an install base of pretty much everyone who owns a computer, tablet, or smartphone. Sometimes it's not about engineering principles.
    

This.

------
oscilloscope
> we still haven’t seen our “Java of the browser”

Haven't we?

<http://en.wikipedia.org/wiki/Java_applet>

------
arocks
> Still, you don’t see that many big Python and Ruby shops either...

But we keep seeing a lot of PHP shops. Does this mean that PHP is better
suited for "large scale projects?" I'd very much doubt that.

The ease of learning a language and it's availability are very important
factors in the popularity of a language. Javascript scores well in this
regard. Really, I am not too worried about Javascript's impending doom. Unlike
Perl, it continues to remain a favorite "target language" making it further
entrenched in most ecosystems.

------
draegtun
Already posted 3 times before to HN this year:

\- <http://news.ycombinator.com/item?id=5016848>

\- <http://news.ycombinator.com/item?id=5014218>

\- <http://news.ycombinator.com/item?id=5020893>

NB. Only the first post has comments.

------
dipthegeezer
Javascript is fairly new, Perl hass been around for ages. So there is a lot of
old code knocking about that was written quickly and by people who quite
frankly did not know what they were doing. Perl5 is actually extremely
readable and if you are any where near a decent developer you will understand
it. I have worked in loads of companies and bad code is bad code no matter the
language. I have have seen some Java code that made me want to give up
development for good, and don't get me started on legacy browser javascript
code.

~~~
edtechdev
"Perl5 is actually extremely readable"

@!&?

~~~
smonff
Absolutely, it is when following readability guidelines and write
documentation. Using obfuscation style is a mess and will never help anybody
but the developer ego who believes he is smarter than everybody. But that's a
pitty to act like that cause it create pain for maintainers and even for
yourself.

------
lsiebert
I'm actually taking a Perl class at the moment, and enjoying the heck out of
it. CPAN is awesome.

------
giusc
Sounds to me like the classic apples and oranges comparison.

In my opinion Javascript's evolution has become a requirement more than just a
story of success. It was the de facto standard language for browsers but with
big lacks of performances. Browsers vendors worked to improve it and
everything was only a natural consequence of the evolution of the World Wide
Web.

Perl's history is completely different. Perl has always worked behind the
scenes, and still does it greatly. It has a stable, rock solid, very
performant and widely spread runtime.

Let's just call things with their names and use them for the purpose they are
born and everything will look less confusing.

More than else, always remember: You can write FORTRAN in any Language.

------
DrinkWater
so much hate in the developer culture. i rather get shit done.

------
spoiler
> JavaScript just waiting for the next technology to come around and make it
> look like Perl does today: pervasive, but lacking enterprise adoption on
> large applications.

How about CoffeeScript?

Also, I worked on some pretty "big" JS projects (in terms of scale, not
popularity) and I found Javascript really easy to maintain, you just have to
plan ahead a little, but I do agree that the syntax is a slightly bit not to
my liking, but it is not horrible.

Also, what type inconstancy is he referring to?

~~~
rcfox
Somebody hasn't seen "wat". <https://www.destroyallsoftware.com/talks/wat>

~~~
Hupo
The fun thing about JavaScript's type coercion and concatenation is that you
can use it to create fun brain benders like this:

    
    
      +[[+!+[[]]]+[![]][+[[]+[]]]++] === 10
    

This evaluates to true. Cookie for anyone who can explain why!

~~~
spoiler
I gues it could be because + infront of an empty array returns 0. So, when you
do !+[] you get 1. What you pasted it a bit of a labyrinth, but if someone
bothered to keep track of it, they could definitely find ten 1s in there. It's
not why, it's a how.

I hope someone figures out the rest and gets a cookie! :D

------
lucian1900
I don't see how Java's idea of type safety is particularly useful for
anything, its type system is almost entirely useless.

I've yet to see compelling arguments for why it might be better in "large"
projects.

~~~
PommeDeTerre
It may not be the greatest, but at least it's better than JavaScript's broken
type system. It does catch at least some problems prior to runtime.

The most compelling arguments regarding this matter are often in the form of
personal experience working with large applications. JavaScript code bases
don't scale well past around 10,000 lines of code and 2 or 3 developers at
most. Languages like Java, C, C++, C# and Ada, on the other hand, can
relatively easily handle software systems with millions of lines of code,
worked on by hundreds or even thousands of developers spread globally.

~~~
mercurial
Its type system is not particularly complex, but it is robust - it doesn't,
for instance, coerce strings-with-numbers-in-it into numbers. Sure, you don't
have sum types, etc, but at least it behaves in predictable ways.

------
tferris
These subtle JS rants every other day are kind of annoying. Comparing JS to
Perl gives a new but still wrong angel on an old tedious discussion.

JS weaknesses are overrated: anybody can grasp all quirks within an hour and
after few days you get used to them (besides there just a few and great
standard libs like underscore making JS a rock-solid base) and JS' bad parts
won't stand in your way anymore. Those who aim for perfection won't get shit
done anyway. They look for the academically structured Rails apps (or replace
with any other bloated framework) with half a second respond times and
breaking after every 0.0.1 update of Rails. In my view JS is damn perfect and
I can think of anything better right now. JS and its ecosystem (especially the
awesome npm) gives you anything to write elegant, well maintainable code bases
ten leagues higher than any script language like PHP and on the same level
like Ruby or Python.

JS is not a hack written in ten days. JS is a wonderful and modern language,
more innovative than most other language out there, it's a masterpiece of a
language. People complain because it's different: it doesn't follow the
traditional OO, there're no strict monolithic frameworks which teach them how
to structure code and most are just overwhelmed with functional programming
and event loops/call backs/asynchrony because they were just used to something
different. This is not being arrogant it's just that people don't like change
or hoping all the time for something better instead of being happy with what
they have now.

You can create and maintain very large code bases in JS without any Coffee or
other layers of abstraction (there enough examples out there). Most people are
just not used anymore to think theirself about structuring code since there
was always somebody who did the job for them (Rails, Django, etc.).

You don't need to compile to JS -- JS is also not the new assembly of the net
because hundreds are building weird languages on top providing useless
syntactic sugar and again old-age OO, it's already a very high level language
allowing you to do ANYTHING and structuring you code exactly as want. Nothing
will stand in your way.

And Javascript is so fast, you get C class performance with a dynamically
typed language. No need to compile after every single change or deploys are
fast and easy without sending huge binaries to the servers. There's no other
language providing this speed for such little cost, no other.

To understand JS' beauty and to get the "flow" you have with other languages
and you do not get with JS you have to do two things: invest time and try to
forget what you learned. And if you still don't get there spend more time with
JS. It's not JS which failed.

JS haters and other downvoters: not agreeing != downvoting

~~~
to3m
It might just depend on one's previous experience. I've not been very
impressed with Javascript the language. I've been a C++ programmer for years,
so I'm well practised at being happy with what I have now rather than wishing
for something better. But I find it difficult to be happy with a language that
doesn't have proper block scope and won't even check function arity. (Dear
computer, stop being so damn lazy.)

But, sadly, it fills a hole that nothing else does.

~~~
tferris
[http://www.quora.com/Why-was-JavaScript-designed-without-
blo...](http://www.quora.com/Why-was-JavaScript-designed-without-block-scope)

------
buster
Mh... "those who hate Perl hate it because it’s “too hard to maintain” and too
“strange.”"... No.. i hate perl because it's too easy to write really, really
bad code and non-obvious how to write good code.

~~~
mutation
There's one obvious way to write good Perl code: read the documentation. Perl
has tonnes of it. There are bugs in there of course, but most of it is very
good. Also try to visit perlmonks.org once in a while - they're good there.
Everything else is just a reason to be lazy and not care about the code you
write.

~~~
aduitsis
And, Perl has an awesome community, let's not forget that. They do love clean
code and all (modern Perl is very easy to read and understand IMHO), but are
aware that in the end you want to get the job done.

Time and again, the question "are there any useful ideas or features in
language X that we can borrow and implement in Perl?" has been posed by
prominent people in the Perl community. Which is the opposite of the "not
invented here" syndrome.

------
jaequery
don't take it lightly of the fact that javascript could theoretically become
the most popular language for decades, mainly due to browser support.

~~~
smonff
Hope they could create a kind of huge centralized 'CJSAN' repository as CPAN
[1] is. I've checked some existing projets [2] but it can hardly list some
hundred modules. NPM [3] is great, but it should himself be integrated into a
larger JS repository in the same way Cpanminus [4] is integrated inside CPAN.

[1] - <https://metacpan.org/>

[2] - <http://plugins.jquery.com/> \- <http://jamjs.org/> \-
<http://jsfromhell.com/>

[3] - <https://npmjs.org/>

[4] - <https://metacpan.org/module/App::cpanminus>

~~~
smonff
And check out how CPAN is an active modules repository :D

<http://stats.cpantesters.org/statscpan.html>

------
dschiptsov
Nope. It is new Java.) Haskell is today's Perl, if you wish.

~~~
fuzzix
Modern Perl is today's Perl.

<http://www.onyxneon.com/books/modern_perl/index.html>

~~~
smonff
Also check out the excellent 2012 Ovid's _Beginning (modern ) Perl_ \-
<http://ofps.oreilly.com/titles/9781118013847/>

------
eksith
Using any technology in hopelessly idiotic ways when better tools (and more
importantly, _appropriate_ tools) exist will turn it to the new [previous-
tech-used-in-hopelessly-idiotic-ways].

This dilemma is as old as programming itself and will only go away when we
introduce public flogging as punishment* for wrongly applying the "laziness is
a virtue" dogma.

* Developers are people too (mostly) and I don't condone public violence against them. Private violence is OK.

~~~
hayksaakian
Please recommend a better option for running code in a web browser.

...

...

...

There is no php, or rails, or asp alternative here as there is with perl.
Correct me if I'm wrong, but the closest thing I've found is 1. NaCl 2...?

~~~
eksith
This isn't about running code in the web browser. This is a greater problem of
offloading what is better off as being server-side processing on the browser.

~~~
mercurial
This comes off as very dogmatic. There are good use cases for single-page or
few-pages webapps. I'm likewise more comfortable server-side, but I can
understand why you would want this sort of thing.

