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条回答
虎瘦雄心在
2楼-- · 2019-01-03 12:23

I see a scripting language as anything not requiring an overt heavy-weight feeling 'compile' step. The main feature from a programmers standpoint is: you edit code and run it right away.

Thus I would regard JavaScript and PHP as scripting languages, whereas ActionScript 3/Flex is not really.

查看更多
可以哭但决不认输i
3楼-- · 2019-01-03 12:23

For a slightly different take on the question. A scripting language is a programming language but a programming language is not necessarily a scripting language. A scripting language is used to control or script a system. That system could be an operating system where the scripting language would be bash. The system could be a web server with PHP the scripting language. Scripting languages are designed to fill a specific niche; they are domain specific languages. Interactive systems have interpreted scripting languages giving rise to the notion that scripting languages are interpreted; however, this is a consequence of the system and not the scripting language itself.

查看更多
Luminary・发光体
4楼-- · 2019-01-03 12:24

It's like porn, you know it when you see it. The only possible definition of a scripting language is:

A language which is described as a scripting language.

A bit circular, isn't it? (By the way, I'm not joking).

Basically, there is nothing that makes a language a scripting language except that it is called such, especially by its creators. The major set of modern scripting languages is PHP, Perl, JavaScript, Python, Ruby and Lua. Tcl is the first major modern scripting language (it wasn't the first scripting language though, I forget what it is, but I was surprised to learn that it predated Tcl).

I describe features of major scripting languages in my paper:

 A Practical Solution for Scripting Language Compilers
 Paul Biggar, Edsko de Vries and David Gregg
 SAC '09: ACM Symposium on Applied Computing (2009), (March 2009)

Most are dynamically typed and interpreted, and most have no defined semantics outside of their reference implementation. However, even if their major implementation becomes compiled or JITed, that doesn't change the "nature" of the language.

They only remaining question is how can you tell if a new language is a scripting language. Well, if it's called a scripting language, it is one. So Factor is a scripting language (or at least was when that was written), but, say, Java is not.

查看更多
Evening l夕情丶
5楼-- · 2019-01-03 12:24

May I suggest that scripting languages has been a term lots of people are moving away from. I'd say it mostly boils down to compiled languages and dynamic languages nowadays.

I mean you can't really say something like Python, or Ruby are "scripting" languages in this day and age (you even have stuff like IronPython and JIT-your-favorite-language, the difference has been blurred even more).

To be honest, personally I don't feel PHP is a scripting language anymore. I wouldn't expect people to like categorize PHP differently from say Java on their resume.

查看更多
干净又极端
6楼-- · 2019-01-03 12:24

The definition of "scripting language" is pretty fuzzy. I'd base it on the following considerations:

  1. Scripting languages don't usually have user-visible compile steps. Typically the user can just run programs in one easy command.

  2. Programs in scripting languages are normally passed around in source form.

  3. Scripting languages normally have runtimes that are present on a large number of systems, and the runtimes can be installed easily on most systems.

  4. Scripting languages tend to be cross-platform and not machine-specific.

  5. Scripting languages make it easy to call other programs and interface with the operating system.

  6. Scripting languages are usually easily embeddable into larger systems written in more conventional programming languages.

  7. Scripting languages are normally designed for ease of programming, and with much less regard for execution speed. (If you want fast execution, the usual advice is to code the time-consuming parts in something like C, and either embed the language into C or call C bits from the language.)

Some of the characteristics I listed above are true of implementations, in which case I'm referring to the more common implementations. There have been C interpreters, with (AFAIK) no obvious compile step, but that's not true of most C implementations. You could certainly compile a Perl program to native code, but that's not how it's normally used. Some other characteristics are social in nature. Some of the above criteria overlap somewhat. As I said, the definition is fuzzy.

查看更多
\"骚年 ilove
7楼-- · 2019-01-03 12:25

A scripting language is a language that is interpreted every time the script is run, it implies having a interpreter and most are very human readable, to be useful a scripting language is easy to learn and use.

Every compilable language can be made into a script language and vice versa it all depends on implementing a interpreter or a compiler, as an example C++ has an interpreter so it can be called a script language if used so (not very practical in general as C++ is a very complex language), one of the most useful script languages at present is Python...

So to answer your question the definition is on the use of a interpreter to run quick and easy scripted programs, to address simple tasks or prototype applications the most powerful use one can make of script languages is to include the possibility for every use to extend a compiled application.

查看更多
登录 后发表回答