When is a language considered a scripting language

2019-01-03 11:38发布

What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only criterion? Or are there other criteria?

See also:

30条回答
Summer. ? 凉城
2楼-- · 2019-01-03 11:59

Traditionally, when talking about the difference about scripting versus programming, scripts are interpreted and programs are compiled. A language can be executed in different ways - interpreted or compiled (to bytecode or machine code). This does not make a language one or another.

In some eyes, the way you use a language makes it a scripting language (for example, game developers who develop mainly in C++ will script the objects in Lua). Again, the lines are blurred - a language can be used for a programming by one person and the same language can be used for scripting language by another.

This is from the wikipedia article about scripting languages:

A scripting language, script language or extension language is a programming language that allows control of one or more software applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the end-user. Scripts are often interpreted from source code or bytecode, whereas the applications they control are traditionally compiled to native machine code. Scripting languages are nearly always embedded in the applications they control.

You will notice the use of "usually", "often", "traditionally" and "nearly always" - these all tell you that there is no set of distinct attributes that make a specific language a "scripting language".

查看更多
乱世女痞
3楼-- · 2019-01-03 11:59

"Scripting language" is one of those fuzzy concepts which can mean many things. Usually it refers to the fact that there exists a one step process taking you from the source code to execution.

For example in Perl you do: perl my_source.pl

Given the above criteria PHP is a scripting language (even though you can have a "compilation" process for example when using the Zend Encoder to "protect" the source code).

PS. Often (but not always) scripting languages are interpreted. Also often (but again, not always) scripting languages are dynamically typed.

查看更多
4楼-- · 2019-01-03 12:00

A scripting language is a language that "scripts" other things to do stuff. The primary focus isn't primarily building your own apps so much as getting an existing app to act the way you want, e.g. JavaScript for browsers, VBA for MS Office.

查看更多
够拽才男人
5楼-- · 2019-01-03 12:00

My definition would be a language that is typically distributed as source rather than as a binary.

查看更多
三岁会撩人
6楼-- · 2019-01-03 12:01

My friend and I just had this argument: What is the difference between a programming language and a scripting language.

A popular argument is that programming languages are compiled and scripting languages are interpreted - However I believe this argument to be completely false...why?

  1. Chakra & V8 (Microsoft's and Google's JavaScript engines) compile code before execution
  2. QBasic is interpreted - does this make Qbasic a "scripting" language?

On that basis, this is my argument for the difference between a programming language and a scripting language:

A programming language runs at the machine level and has access to the machine itself (memory, graphics, sound etc).

A scripting language is sand boxed and only has access to objects exposed to the sand box. It has no direct access to the underlying machine.

查看更多
Explosion°爆炸
7楼-- · 2019-01-03 12:04

I would say scripting language is the one heavily manipulating entities it doesn't itself define. For instance, JavaScript manipulates DOM objects provided by the browser, PHP operates enormous library of C-based functions, and so on. Of course not a precise definition, more a way to think if it.

查看更多
登录 后发表回答