7 ms·
Why "script" though? Aren't Java and JavaScript both script(ing languages)? Why not call it e-Java or Java XYZ or something?
by JxLS-cpgbe0 6y ago
Why "script" though? Aren't Java and JavaScript both script(ing languages)?
Why not call it e-Java or Java XYZ or something?
- Scarblac 6y agoI've never seen Java called a scripting language before, actually.
- calibas 6y agoThis is all semantics, but the idea was that Java is a "real" language for serious use and JavaScript is a "script" that's much easier to use and doesn't involve all the complications of a "real" programming language. It was only kind of true back then, and not even remotely true now. There really isn't a solid line you can draw between a "script" and a "programming language". To me, something like Python is right in between.
- mlyle 6y agoTo me, if something acts logically like it is run from top to bottom, it's a scripting language. Python scripts and JavaScript are in this category; Java isn't. Additionally, explicit compilation/linking/assembly shouldn't be required for a scripting language, even if the interpreter does stuff kind of like this behind the scenes for performance.
- zepto 6y agoThat makes Ocaml and Haskel into scripting languages.
- kccqzy 6y agoYou can't just put `putStrLn "Hello"` in the top level of a Haskell program and expect it to work. You can do it in a REPL, but that's besides the point.
- zepto 6y agoSure. I was responding to this: “To me, if something acts logically like it is run from top to bottom, it's a scripting language.” I don’t see them as scripting languages, but that definition would include them.
- kccqzy 6y agoAnd my point is that Haskell doesn't even look like it's run from top to bottom. Example, consider this mutually recursive definition at the top level: a = 1:b b = 2:a It doesn't, by any means logical or not, look like it runs from top to bottom. If so, the first line would have immediately been an error because `b` is an undefined name.
- deleted 6y ago[deleted]
- zepto 6y agoMy mistake - I thought Haskell was like OCaml in not having a main function: http://stackoverflow.com/questions/28711563/ddg#28711778 http://stackoverflow.com/questions/28711563/ddg#28711778 You broadly dismissed my entire comment, which was completely correct about Ocaml, but I accept that you are correct about Haskell.
- smt1 6y agoHow about CPS style? https://golem.ph.utexas.edu/category/2008/01/the_continuation_passing_trans.html https://golem.ph.utexas.edu/category/2008/01/the_continuatio... Keep in mind that if you're implementing a branch predictor in HW, most CPUs will already be speculatively pre-running all sorts of code speculatively. Most of the current gen static analyzers/compilers linearize into basic blocks and run graph theoretic peephole compiler optimization passes, but that certainly isn't the only way to do to it. I guess with the future of hardware heterogeneous this is why data-flow or even more hybrid type of computer architectures are hot instead of mostly control flow-types of checks.
- sdenton4 6y agoI feel like "requires compilation" is a good first order differentiator. And "has a somewhat sane type system" is another.
- cozzyd 6y agoWell, C++ can be interpreted (sort of, see CINT) and can certainly be semi-transparently jitted (see cling). Although it's certainly not designed for that!
- colejohnson66 6y agoC# 9 added “top level statements” which seems to be the first steps towards usage in a script environment. https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9 https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csh...
- wwright 6y agoTemplates are turing complete and universally interpreted AFAIK (I don't think any implementation compiles them before evaluation?). There's also features like constexpr these days.
- kevin_thibedeau 6y agotcc is fast enough to run C code (or langs targeting C) as scripts.
- triceratops 6y agoTypeScript requires compilation and has a rich type system. It also has "script" in the name. I think "scripting" vs "programming" language differentiation is elitist nonsense. This isn't a meaningful boundary. It's more useful to speak of languages in terms of strong/duck/loose typing, syntax, supported programming paradigms, ecosystems, available libraries and tooling, and intended use cases.
- vlunkr 6y ago> There really isn't a solid line you can draw between a "script" and a "programming language" I think it's easier to draw the line if you have the requirements right. That's not the line that was being drawn. it was scripting vs compiled languages. It was very clear then which sides Java and Javascript fell on. There are some weird cases now like compiling scripts into different scripts, but in general it's pretty clear, and Python is definitely a scripting language.
- calibas 6y agoThe great "script vs programming language debate". The difference is clear to you because you have a clear definition in your mind. The problem is that the definition changes depending on who you talk to, which invites endless debate.
- vlunkr 6y agoWell it's a pretty bad debate if people aren't agreeing on definitions. Hence this whole chain of comments.
- ptx 6y agoBasing the definition on whether it's compiled or not doesn't help much. Python is actually compiled to bytecode, just like Java. Is it not a scripting language? Or is the distinction that the Python bytecode is interpreted whereas Java is JIT compiled to machine code? Well, Java didn't get the JIT compiler until version 1.3 - so was Java 1.2 a scripting language?
- sjy 6y agoThe distinction is the existence, from the developer’s perspective, of a separate step called “compilation,” which produces an executable artefact which can be distributed but not converted back to the source code. It’s about programming in practice, not fundamental computer science principles.
- mlyle 6y agoHow could one consider Java a scripting language? It's compiled to .class files, has no reasonable interactivity, strict structure enforced upon the code, etc. E.g. the antithesis of what makes us call something a scripting language in basically every category.
- JxLS-cpgbe0 6y agoSo JavaScript meant "complement to Java, but converted to machine language in the browser, instead of compiled?" (Thank you, genuine question)
- pan69 6y ago> So JavaScript meant "complement to Java The whole JavaScript thing was just marketing. In 1995, Java was THE hottest thing so associating it with Java might fuel adoption/acception. There is an old saying; Java is to JavaScript what Car is to to Carpet. Re. your compiled question. It's up to the browser on how to execute JavaScript. E.g. Chrome has the V8 engine. This is the VM that compiles and executes JavaScript within Chrome. Other browsers might have different engines. https://en.wikipedia.org/wiki/V8_(JavaScript_engine) https://en.wikipedia.org/wiki/V8_(JavaScript_engine)
- mlyle 6y agoJavaScript is "logically" run line by line from the beginning of the script. This may not be exactly true anymore for performance reasons, but it's the logical model behind it. A single set of expressions to run in order "a=1+1;" is a conformant JavaScript script; hence, it's a scripting language. It doesn't take much imagination about how to have a JavaScript console that operates interactively from user input. Java code has lots of structure required to write a minimal program. Java is transformed by compilation into a set of .class files. Then, in turn, a loader loads, resolves all the classes, and begins transforming and executing code. These distinctions can be muddy sometimes.
- gpvos 6y agoMore like interpreted rather than compiled. (I'm pretty sure a google search on "interpreted versus compiled" will get you up to speed with the basics on this point.) This is generally seen as one of the main differences between "scripting" and "serious" languages. The twist is that the JVM (Java Virtual Machine) is also a kind of interpreter, but can do on-the-spot ("just-in-time") compilation of parts of the code as well.