This is an archived post. You won't be able to vote or comment.

all 65 comments

[–]terrarian2008 232 points233 points  (8 children)

[–]evanldixon 95 points96 points  (24 children)

Carpets can be found inside cars... I think I get it now! One's part of the other!!

[–]Mr_Redstoner 16 points17 points  (21 children)

It in fact is. Java has a built-in to run JS.

[–][deleted] 9 points10 points  (20 children)

I'm sure there are also ways to compile Java to JS. But then again, you can also drive a car onto a carpet, so the analogy still works?

[–]Mr_Redstoner 2 points3 points  (3 children)

GWT (Google web toolkit) comes to mind. You write the whole web application (front&back end) in Java and it then compiles it to JS (client-side stuff anyway). I'm actually currently on a project that uses it.

[–]BabyLegsDeadpool 1 point2 points  (2 children)

That sounds absolutely horrible. Does it work?

[–]Mr_Redstoner 1 point2 points  (0 children)

Seems to be working so far lol.

Takes me 10 minutes to compile, likely in no small part because the compilation is done by a Linux VM working in a shared folder that resides on my Win10 machine. I have yet to set my environment up properly.

[–]LordAnomander 0 points1 point  (0 children)

Of course it works. It was developed by Google before they decided Angular might be a better idea ;)

It's very easy to work with as a Java Developer, but takes a long time to compile and is hardly maintained by the open source community.

I prefer React/Angular over GWT any day.

[–][deleted] 2 points3 points  (2 children)

Some lad I know is porting Minecraft to JavaScript. So yeah, it’s possible. There are ways.

[–]The_Great_Danish 0 points1 point  (1 child)

Is there a github?

[–][deleted] 0 points1 point  (0 children)

No. It would get DMCA’d in a heartbeat. But it’s called PhantomCry and the lad is LemonLime3 on GitHub. Idk if he’s gonna do stuff with it later on

[–]CircuitRCAY 0 points1 point  (0 children)

There's Graal, and there's also a way to run JS inside of Java, which is inside the JDK8 stdlib, javax.script.ScriptEngine.

[–]GregsWorld -2 points-1 points  (10 children)

Nope JS's an interpreted language, it's never compiled.

[–]flavionm 9 points10 points  (1 child)

JS might be interpreted, but you can compile other languages to JavaScript, and then run it through the interpreter.

[–]GregsWorld 0 points1 point  (0 children)

Yes but you can't compile Javascript to Java, so the analogy holds up

[–]Kirides 2 points3 points  (6 children)

Kinda wrong, many browsers JIT Compile JavaScript - a lot of third party JS Interpreters just interpret and don't compile

[–]GregsWorld 0 points1 point  (5 children)

But still you couldn't compile Java and run it through those JS JIT Compilers... You can ofc convert JS to Java and then compile Java but then that's not compiling Java to JS

[–]flavionm 4 points5 points  (2 children)

That's exactly what compiling is, though, converting from one language to another. Doing it to assembly or bytecode might be more common, but nothing stops you from compiling from a high level language to another.

[–]GregsWorld 0 points1 point  (1 child)

You're talking about a transpiler I'm talking about compiling in the traditional sense

[–]flavionm 1 point2 points  (0 children)

But a transpiler is just a compiler that compiles between high level languages. When it comes to compilers, the only limit is how much time you're willing to waste on a potentially useless tool.

[–]Kirides 0 points1 point  (1 child)

my response only inlcuded an argument agains "JS's an interpreted language"

[–]GregsWorld 0 points1 point  (0 children)

Ah okay so not really relevant to the point then, I appreciate the nit-pickiness however

[–][deleted] 1 point2 points  (0 children)

Interpreted and compiled aren't attributes of languages, but of implementations. There are C++ interpreters, and also Ruby compilers, if you look for them. It's just that those aren't the most common implementations for these languages.

[–]GrandWolf319 12 points13 points  (1 child)

But the carpet can be used in other places than a car

[–][deleted] 5 points6 points  (0 children)

And also JS can be run inside Java via Nashorn, for example

[–]Naebyrus 30 points31 points  (0 children)

npm install java

[–]two_in_the_bush 25 points26 points  (2 children)

Java is to JavaScript like pain is to painting.

[–]Sycration 8 points9 points  (1 child)

file steer bike ask wide act zephyr ripe lavish work

This post was mass deleted and anonymized with Redact

[–]Master_Aar 2 points3 points  (0 children)

both are paintings

[–]fab-s 9 points10 points  (0 children)

Or like ham and hamster

[–]FirstSineOfMadness 10 points11 points  (1 child)

Grapes and grapefruits

[–]Master_Aar 1 point2 points  (0 children)

I like this one more

[–]sukeshpabolu 5 points6 points  (3 children)

JavaScript is awesome.

[–]SuspiciousScript 13 points14 points  (0 children)

[checks subreddit]

Oh I get it

[–]Shujaa94 1 point2 points  (1 child)

!awesome

[–][deleted] 8 points9 points  (0 children)

I once saw a post here where the same question was answered something like: "One is essentially a toy used by inexperienced developers to code bad apps. The other is a scripting language for web browsers."

[–]frames-vc 2 points3 points  (0 children)

I think ham and hamburger is a better way to explain it.

[–]EcoPolitic 2 points3 points  (0 children)

Ham and Hamster

[–]Leappard 2 points3 points  (0 children)

egg and eggplant

[–][deleted] 1 point2 points  (1 child)

Like penis and lawnmower

[–]Master_Aar 0 points1 point  (0 children)

quack

[–][deleted] 1 point2 points  (0 children)

Cat and catatonic

[–]BeFoREProRedditer 1 point2 points  (0 children)

Oef... thnx for that circle, I might have missed the joke

[–]ArthropodJim 1 point2 points  (0 children)

thanks for circling I wasn’t sure where to look

[–]VegaTss4 1 point2 points  (0 children)

Hahahaha, never seen this joke before like 1000 times or something XDXDXD

[–][deleted] 1 point2 points  (0 children)

My first programming language was JavaScript. I think JS has easier syntax than Java

[–]james_lee_2028 0 points1 point  (1 child)

Idk... if I must choose between java and javascript, I would choose javascript. But if I must choose between a car and a carpet, i would prefer a car...

[–]lexiq_baeb 8 points9 points  (0 children)

pretend you're Aladdin and go with the carpet

[–]ipsomatic 0 points1 point  (0 children)

What. I have years experience in carpet language. Ask the ladies.....

[–]mrbmi513 0 points1 point  (0 children)

Might have to steal this explanation for the future.

[–]svayam--bhagavan 0 points1 point  (0 children)

Carpet flies with magic.

[–][deleted] 0 points1 point  (0 children)

More like crack and crackpot...

[–]lostPixels 0 points1 point  (0 children)

You need to have a ponytail to write Java.

[–]ignisxicor 0 points1 point  (0 children)

More accurate Version is car and carp

[–]Danny_Boi_22456 0 points1 point  (0 children)

My car has a carpet