Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am not able to understand why and in what kind of scenario I would like to run scripting language inside JVM at server side. I mean we already have great libraries available in JAVA... why wouldn't I use use them to do stuff instead of running scripts in JVM?
Please help me understand this concept, Can someone please tell me one or two use cases where running scripting in JVM at server side will have advantages over using JAVA libraries.
The more general question here is "Why would I want to execute code in <some scripting language> in Java?", where Javascript is simply one example of such a language.
Quoting this article:
Some Java applications' requirements make integration with a scripting language necessary. For example, your users may need to write scripts that drive the application, extend it, or contain loops and other flow-control constructs. In such cases, it's sensible to support a scripting language interpreter that can read user scripts, then run them against your Java application's classes.
Basically: if you want to allow your users to customize your application in a way that requires the richness of a programming language.
Why Javascript specifically? That depends upon your application. There may be reasons to pick that (e.g. your target users already know Javascript), or not (e.g. Lua is more popular for scripting in the games industry).
One use i can think of is:
Javascript engine can be used to evaluate arithmetic expressions
which are in a String format.
example :: String expression = "2+4";
The below is the link to a example which uses java script engine to do this.
https://stackoverflow.com/a/3423360/4626402
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
This is a question of interest, There are a number of interpreted languages that can be used to create an OS, Can one create an Operating system using PHP or JS.
It does not have to be a fully-fledged OS, at least the one that prints Hello World.
Regards
All three of those languages are Turing-complete, so they can simulate any other Turing-complete language. An operating system written in one (or a few) Turing-complete language can also be written in another, assuming that sufficient access to the underlying hardware is provided.
Whether such a thing could be made to be run any any reasonable speed is another matter entirely.
The number of things you can do in programming is virtually limitless, but many of those things require a lot of effort.
The main purpose of an operating system is to provide an interface between application programs and the computer hardware, often abstracting away details. In order to do this, the OS code must be able to access the hardware directly (or almost directly, e.g. by calling BIOS functions).
High-level languages like PHP and JavaScript don't have any mechanisms to do this. They depend on an operating system to provide access to hardware at a high level: files, network sockets, etc.
These languages do allow you to link in extension libraries, which give them extra capabilities. But then you're not actually writing the OS in these languages, you're writing it in the language that the extension is written in.
I don't think even C can be used to write an OS if you just stick to the portable features of the language. Operating systems written in C depend on implementation-dependent features such as casting integers to pointers, they use extensions like asm(), or they occasionally link with subroutines written in assembly, on order to get direct control of the hardware.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
What are the differences and similarities between QML and Javascript?
I am doing research on it, as I will probably give of a small presentation about QML soon. I have already looked at it on wikipedia, but I was hoping to get some answers from people with experience.
Note: I know some QML, I don't know any Javascript.
QML is a declarative language describing a tree of objects (in the QtQuick case a tree of visual items). The documentation has a fairly comprehensive documentation of the language. QML is used in the Qt framework only.
Javascript is an imperative language. Javascript is a very popular language used in many different places, for example embeddded in HTML sites or as part of node.js servers.
QML can actually include Javascript snippets, for example for bindings and signal handlers.
QML and Javascript serve very different purposes, so I don't see how to provide a list of similarities and differences.
Getting some downvotes there, my guess is that it is because you didn't research enough before coming here. And possibly because it doesn't sound like you are quite ready for a presentation on these languages.
But I'll see if I can at least point you in the right direction; QML is what is called a "markup language", not unlike XML, whereas Javascript is an "imperative language", like many others such as Python, C and Rust. More similar to Python, as it is also an "interpreted" language, whereas the others mentioned are "compiled" languages.
Hope it helps!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Few year back I read on some websites that "JavaScript is only a client-sided language".
is it so? if not then why?
Remember that JavaScript was some day Netscape LiveScript and it was already a client and server programming language. In fact, ASP Classic could be developed using JScript (basically, old JavaScript).
A language turns into a server-side language once it can be used to develop back-end code, and yes, JavaScript has been always a player in the server development.
Now with NodeJS, JavaScript has been turned into a possible and serious language of choice to develop backends.
Eventhough JavaScript was first developed to be used in a browser, the language itself has never been a strict client side language.
Aside from a few string methods that create HTML tags, there is nothing in the language itself that is specific to client side programming. Everything related to the browser is in the DOM, not in the JavaScript language.
JavaScript is used in client side scripting (and that use is almost analogous to client side scripting), but branding it a client side language would be misleading. The fact that the language itself doesn't contain the browser integration has made it easy to adapt it to other environments, including server side scripting.
Node.js is far from the only server side scripting using JavaScript. ASP for example offered VBScript and JScript (Microsofts implementation of JavaScript) as server side languages. This list compares 28 different server side uses, and it's not all there is.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a website which is used on Chrome and IE8. I made it with Javascript and it works fine on Chrome but it is slow on IE.
Is VBScript faster than Javascript on IE? Would I translate my code in VBScript for IE?
VBScript is executed for web sites on IIS(web servers), JavaScript mostly on client side.
I do not see how it would not work on any browsers unless you uploading something to client machines as vbs file. That is dangerous and could be considered as security threat - antivirus program may simply block it or delete file all together.
Basically question is not about if VBScript supported or not by any browsers simply because browsers never-ever touching VBScript, but what you attempt to do with VBScript. And anyone who is saying that it does not supported by any browser need to take a lessons from W3S school all over again.
It is different purpose scripting languages on the web: VBScript for servers side processing while JavaScript mostly to be used running on client side. And before anyone starts discussing that JavaScript can be used on server side please look what I put in bold letters. There are javascript libraries AJAX and JQUERY etc. which can be used to process data as well as connecting to web servers.
If you are looking for replacement of VBScript - C# is the best place to start since you already working on Microsoft platform, NET would be logical choice. There is lot of other languages to choose from but you need carefully consider what your project is all about, budget and time needed to rebuild your project/site.
However you can write VBScript and JavaScript batch files for local execution but as I understand that is not part of your question.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
As far as I know, JavaScript can be used to do everything that is possible in Scheme.
Every functional programming paradigm I've learnt in Scheme is doable in JavaScript.
I know that one may end up using JavaScript to write ungood code (ones with global variables, too many states and side effects) where as Scheme restricts one to write functional code.
But apart from that, is it really necessary to use Scheme anywhere over JavaScript?
For those of you who say JavaScript can be interpreted only on a browser kindly draw the same question to Python and Scheme.
Let me pose a similar question:
Is there a reason to use French over English? Anything that you can express in French you can express in English, so is it really necessary to use French over English? Kindly draw the same question to Russian, German, Spanish, or any other spoken language you choose.
No programming language is completely unique, anything you can do in one language can be done in a different language, some implementations might require a bit more creative thought but it can still be done.
Some reasons to use Scheme instead of JavaScript or Python:
You appreciate the simplistic and minimalist structure of the
language
Ease of implementation when compared to expressive power (lambda
expressions)
You are more familiar with Scheme
The client has existing code in Scheme
Specific implementations or algorithms might have a min/max calculation available to give exact benchmarks, but you would have to look at specific algorithms. In general there is no way to define one language as always better in all situations (or even 'never worse'), and trying to pigeon hole oneself into a single language is dangerous. In my opinion, open mindedness is one of the biggest strengths a programmer can have. Being able and willing to use different languages or techniques can be a powerful tool.
I personally suggest further reading by looking up Polyglot Programming. It isn't directly related to your question, but it is a mentality that speaks to the benefits of knowing and using a variety of languages.