开发者

What is difference between scripting languages and other languages [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

When is a language considered a scripting language?

I am really confused between different types of languages. Can any one guide what are diff types of languages or diff categories.

Like some开发者_如何学运维 saying python is scripting langauge. Now what does that mean. Are other langueages like php , asp , java not scripting langauges


The name "Scripting language" applies to a very specific role: the language which you write commands to send to an existing software application. (like a traditional tv or movie "script")

For example, once upon a time, HTML web pages were boring. They were always static. Then one day, Netscape thought, "Hey, what if we let the browser read and act on little commands in the page?" And like that, Javascript was formed.

A simple javascript command is the alert() command, which instructs/commands the browser (a software app) that is reading the webpage to display an alert.

Now, does alert() related, in any way, to the C++ or whatever code language that the browser actually uses to display the alert? Of course not. Someone who writes "alert()" on an .html page has no understanding of how the browser actually displays the alert. He's just writing a command that the browser will interpret.

Let's see the simple javascript code

<script>
var x = 4
alert(x)
</script>

These are instructs that are sent to the browser, for the browser to interpret in itself. The programming language that the browser goes through to actually set a variable to 4, and put that in an alert...it is completely unrelated to javascript.

We call that last series of commands a "script" (which is why it is enclosed in <script> tags). Just by the definition of "script", in the traditional sense: A series of instructions and commands sent to the actors. Everyone knows that a screenplay (a movie script), for example, is a script.

The screenplay (script) is not the actors, or the camera, or the special effects. The screenplay just tells them what to do.

Now, what is a scripting language, exactly?

There are a lot of programming languages that are like different tools in a toolbox; some languages were designed specifically to be used as scripts.

Javasript is an obvious example; there are very few applications of Javascript that do not fall within the realm of scripting.

ActionScript (the language for Flash animations) and its derivatives are scripting languages, in that they simply issue commands to the Flash player/interpreter. Sure, there are abstractions such as Object-Oriented programming, but all that is simply a means to the end: send commands to the flash player.

Python and Ruby are commonly also used as scripting languages. For example, I once worked for a company that used Ruby to script commands to send to a browser that were along the lines of, "go to this site, click this link..." to do some basic automated testing. I was not a "Software Developer" by any means, at that job. I just wrote scripts that sent commands to the computer to send commands to the browser.

Because of their nature, scripting languages are rarely 'compiled' -- that is, translated into machine code, and read directly by the computer.

Even GUI applications created from Python and Ruby are scripts sent to an API written in C++ or C. It tells the C app what to do.

There is a line of vagueness, of course. Why can't you say that Machine Language/C are scripting languages, because they are scripts that the computer uses to interface with the basic motherboard/graphics cards/chips?

There are some lines we can draw to clarify:

  1. When you can write a scripting language and run it without "compiling", it's more of a direct-script sort of thing. For example, you don't need to do anything with a screenplay in order to tell the actors what to do with it. It's already there, used, as-is. For this reason, we will exclude compiled languages from being called scripting languages, even though they can be used for scripting purposes in some occasions.

  2. Scripting language implies commands sent to a complex software application; that's the whole reason we write scripts in the first place -- so you don't need to know the complexities of how the software works to send commands to it. So, scripting languages tend to be languages that send (relatively) simple commands to complex software applications...in this case, machine language and assembly code don't cut it.


A scripting language is typically interpreted instead of compiled.


See scripting-and-programming, whats-the-difference-between-a-script-and-an-application and many similar discussions.


There are many taxonomies for classifying programming languages.
In regard to scripting, a scripting language (python, ruby, php) is a language that runs on an interpretor directly from source code.
Other languages are either compiled languages (run from binary form: c, c++, pascal) either intermediate, compiled to an intermediary form and run inside a virtual machine (java, c#).


A scripting language is a language that focuses on making it easy to chain together or manipulate other programs

Wikipedia says:

"When a language is used to give commands to a software application (such as a shell) it is called a scripting language"

"A scripting language, script language or extension language is a programming language that allows control of one or more software applications."

This is orthogonal from whether it is interpreted or otherwise - Java was originally interpreted, for example, but nobody called it a scripting language. It just happens that, if you're implementing a scripting language, interpreting it is a straightforward approach to take.

Many scripting languages are compiled, either to bytecode or to machine code, often with JIT.


The distinction between script languages and other languages is mostly between interpreted, dynamically typed languages (for example PHP, VBScript, JScript and Javascript), and compiled, statically typed languages (for example C#, VB.NET, Java, C++ and Delphi).

ASP is not a language, but a platform for scripting languages (VBScript / JScript), while ASP.NET is a platform for compiled languages (mainly C# / VB.NET).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜