When is a language considered a scripting language?
Solution 1
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.
Solution 2
Simple. When I use it, it's a modern dynamic language, when you use it, it's merely a scripting language!
Solution 3
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".
Solution 4
"A script is what you give the actors. A program is what you give the audience." -- Larry Wall
I really don't think there's much of a difference any more. The so-called "scripting" languages are often compiled -- just very quickly, and at runtime. And some of the "programming" languages are are further compiled at runtime as well (think of JIT) and the first stage of "compiling" is syntax checking and resource resolution.
Don't get hung up on it, it's really not important.
Solution 5
My definition would be a language that is typically distributed as source rather than as a binary.
Related videos on Youtube
Sietse
Updated on July 08, 2022Comments
-
Sietse almost 2 years
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:
-
Kent Fredric over 15 yearsYou may want to expand on you're question a little. I feel this is almost a dupe otherwise. Others may not see the distinction
-
Kent Fredric over 15 yearsstackoverflow.com/questions/98268/… There is a lot of similiarity. Not nessecarily identical, but a lot of shared context/opinion.
-
ngeek over 15 yearsThis duplicates stackoverflow.com/questions/100905/…
-
Sietse over 15 yearsI don't think so. A language is different from the act of using it. For instance, I could "script" in php, even though it probably isn't considered a scripting language (anymore).
-
anon6439 over 15 yearsPHP is definitely considered a scripting language.
-
ivan_ivanovich_ivanoff over 14 years...When a language breaks the API and changes it's syntax every minor release, when it's a wrapper around 100 of dirty unmaintained buggy C libraries, then it's a script language. ;)
-
Admin almost 14 yearsPossible duplicate: stackoverflow.com/questions/1514206/…
-
dmckee --- ex-moderator kitten almost 14 yearsIn the "Related" sidebar you'll find stackoverflow.com/questions/1514206/… to which I linked a pile of then existing duplicates going back to stackoverflow.com/questions/101055/… .
-
Admin almost 14 yearsPossible duplicate: stackoverflow.com/questions/101055/…
-
-
Kent Fredric over 15 yearsEven tho I work in php a lot, I would say that untill it moves from being script-based to having a /real/ fcgi servlet model dispatching tasks delegated from the server, I would personally call it "a rather good scripting language, which can give the illusion of an application"
-
Sietse over 15 yearsSo you think php, python, etc are scripting languages?
-
user1066101 over 15 years"Scripting" is a common description for Python and PHP.
-
Robert S. over 15 yearsHilarious that the accepted answer has two downvotes.
-
Joseph Ferris over 15 yearsThere should be some sort of badge for that. How about "Can't handle the truth."? Nah, a little too wordy. ;-)
-
anon6439 over 15 yearsNo computer can run perl or ruby (or any form they could be compiled into) natively. Therefore perl and ruby are scripting languages, interpreted by a parser or VM.
-
Jacob over 15 yearsPerl compiles to byte-code before it runs.
-
Jacob over 15 yearsStatic / Dynamic, there are dynamic languages that are compiled.
-
Robert Gould over 15 yearsI repeat: 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 snd JitYourFavoriteLanguage, the difference has been blurred even more).
-
PhiLho over 15 yearsMmm, PHP uses the underlying C library, but it is the case for most languages, including Java (at the lowest level). And it doesn't manipulate these functions...
-
mthurlin over 15 yearsYou are calling pretty much all languages except those who compile into native binary for scripting languages? Im sure the Java-developers will be happy to be called scripters ;)
-
anon6439 over 15 yearsThey are. Scripters, that is.
-
Eineki over 15 yearsWhat about Java? You need a jvm to run a java program but I wouldn't call it a scripting language
-
Jonathan Leffler about 15 yearsPerl, Python, Ruby, Tcl/Tk - to name but four scripting languages - are not primarily built into a larger application.
-
Milen A. Radev about 15 yearsErgo - they are not scripting languages.
-
Antony Carthy almost 15 yearsphp and python - of course they are scripting languages!
-
Roberto Bonvallet almost 15 yearsYeah. "It's not a 'toy language', it's a 'high-level language'" :P
-
Admin over 14 yearsthis is what my definition has been since the start
-
Paul Biggar over 14 yearsThis doesnt answer the question at all!
-
Paul Biggar over 14 yearsJava hasn't been interpreted in a long time.
-
Noon Silk over 14 yearsUh yeah, it'd be nice if this could be unmarked as correct somehow.
-
Stefano Borini over 14 years@psoul: yes. so is java.
-
user3629501 over 14 yearsLet me re-state that, a scripting language is one where the compiler is included and it is possible to execute code generated on the fly. How does that not answer the question?
-
Admin over 14 yearsThis is silly. A modern JavaScript engines are more than just simple text scanners -- would knowing that "they had JIT compilers" change the summation? See: ejohn.org/blog/tracemonkey Or what about Clojure which compiles-on-the-fly to Java Bytecode? (And is Java and/or the JVM... time for soccer :)
-
Paul Biggar about 14 yearsThat is an interpreted language. If you are trying to say that any interpreted language is a scripting language, say that.
-
user3629501 about 14 yearsWell, all languages can be used for scripting, the key item for me is how suitable they are. For me the distinguishing feature is that, yes, they are interpreted.
-
Donal Fellows almost 14 yearsJust so you know, Java's implemented in C++.
-
Amr Elgarhy almost 14 yearshmmm, so what about javascript? is it programming or scripting?
-
Laz almost 14 yearsthats it? but every interpreted language is not called a scripting language. I'm still confused!
-
sepp2k almost 14 years@Amr: Well it is called javascript
-
Oded almost 14 years@Amr ElHarhy - Javascript started off as a purely scripting language. If you really want to look at a language that blurs the definition, look at python.
-
Amr Elgarhy almost 14 years@sepp2k so its not programming language?
-
Oded almost 14 years@Ram Bhat - it is confusing, as the distinction is artificial.
-
Laz almost 14 yearsyou guys are giving examples..I'd like to know WHAT would classify a language as scripting language? other than compiled and intepreted
-
Andrey almost 14 years@Ram Bhat: fact of compilation. is C compiled? yes, so it is not scripting. is Javascript compiled? no, then scripting.
-
Laz almost 14 yearshmmm.. I'm not hung up, but most interviewers and teachers are. And I've never had anyone of these people give me a satisfying answer!
-
Jörg W Mittag almost 14 years@Andrey: All modern JavaScript implementations are compiled. And there are interpreters for C.
-
Quentin almost 14 years@Jörg +1 and this is what brings us back to the distinction being useless.
-
mouviciel almost 14 yearsWhat about Objective-C ?
-
Laz almost 14 years@Andrey Isn't that software dependant? I mean I've come across C language interpreters! So by that definition it means C is both a scripting language and a "normal" programming language!!
-
Andrey almost 14 years@Jörg W Mittag: proove it please. i know that js is being compiled, but i doubt about All
-
Clinton Pierce almost 14 yearsAnd if you gave one of the other answers here, as an interviewer I'd think you really didn't have a handle on the question. The distinction really is blurry and there's no clear-cut answer. If you'd said "Well, traditionally..." I'd take that, but then I'd expect you to discuss things like runtime compilation and JIT'ing as well.
-
Timo Westkämper almost 14 yearsIt supports dynamic typing, but I wouldn't call it a scripting language.
-
Jörg W Mittag almost 14 yearsThis is just plain wrong. Well, actually it is not even wrong, it just plain doesn't make sense. There is no such thing as a compiled or interpreted language. A language isn't compiled, a language just is. It's a bunch of abstract mathematical rules. Interpretation and compilation are traits of an execution engine, not a language. Every language can be implemented with either a compiler or an interpreter. In fact, all the languages that have been cited as "interpreted" on this page, have almost exclusively compiled implementations, for example JavaScript, PHP, Python, Ruby.
-
Laz almost 14 yearsThanks.. This makes things a bit clearer. So to recap, scripting languages are designed to use already existing programs together in a sequence. BUT languages like C can be used to do the same via API's. So technically speaking it all depends upon use
-
Jörg W Mittag almost 14 yearsThis is just plain wrong. Well, actually it is not even wrong, it just plain doesn't make sense. There is no such thing as a compiled or interpreted language. A language isn't compiled, a language just is. It's a bunch of abstract mathematical rules. Interpretation and compilation are traits of an execution engine, not a language. Every language can be implemented with either a compiler or an interpreter. In fact, all the languages that have been cited as "interpreted" on this page, have almost exclusively compiled implementations, for example JavaScript, PHP, Python, Ruby.
-
Jörg W Mittag almost 14 yearsThere is no such thing as a compiled or interpreted language. A language isn't compiled, a language just is. It's a bunch of abstract mathematical rules. Interpretation and compilation are traits of an execution engine, not a language. Every language can be implemented with either a compiler or an interpreter. In fact, all the languages that have been cited as "interpreted" on this page, have almost exclusively compiled implementations, for example JavaScript, PHP, Python, Ruby.
-
wlangstroth almost 14 yearsNo, you're just making an artificial distinction (which is what this is). If you can whip up something quickly with it, a language will often be called a scripting language, but that's not a strict definition or anything. Commonly interpreted languages are often called scripting languages as well.
-
Jörg W Mittag almost 14 years@Andrey: Chakra (IE9), TraceMonkey/JägerMonkey (Firefox), Nitro (Safari), Carakan (Opera) all compile JavaScript to bytecode and then some of the bytecode is interpreted and some compiled to native code. V8 (Chrome) skips bytecode and compiles JavaScript straight to native code. IronJS compiles JavaScript to CIL bytecode. Rhino compiles JavaScript to JVML bytecode. BESEN (the only ECMAScript 5 engine so far) compiles JavaScript to BESEN bytecode, and a native compiler is currently being added. Some of the above also compile regular expressions to native machine code.
-
FrustratedWithFormsDesigner almost 14 years@Will: any distinction would be artificial. This was my opinionated distinction. ;)
-
wlangstroth almost 14 yearsyeah, but "scripting" in this case is a highly colloquial and vague usage. Deciding that it's "to use already existing programs together in a sequence" is very specific, and not quite right. That sounds like a shell script, maybe, but not Perl. Then to contrast that with APIs (?) ... I just didn't want the guy to get too far off track.
-
Timo Westkämper almost 14 years@jorg-w-mittag, Feel free to edit my answer to make it more correct. Your points are valid. Normally though, if you talk about a language, you also talk about the default execution engine.
-
Jörg W Mittag almost 14 yearsActually, the original BASIC implementation was a compiler. It was only later that BASIC clones were written as interpreters, because interpreters are supposedly easier to write than compilers.
-
Oded almost 14 years@Jörg W Mittag - thanks for your comments. I have updated my answer to address the issues you have raised.
-
PauliL almost 14 years@Jörg: Not quite so. While the very first test implementations of Dartmouth BASIC were compiled (called Card BASIC) the actual implementations were interpreters. In fact, probably the most important new feature of BASIC was that it was interactive. No need to punch the source code into a cards and feed them to compiler. The user could just sit at the teletype, write the program and then run it.
-
Oak almost 14 years@Jorg: Good point, I agree. But I didn't say that cannot be compiled, just said that these kinds of languages are typically interpreted rather than compiled, in common usage.
-
Jörg W Mittag almost 14 yearsAre they? All current implementations of Python, PHP, Perl and Lua are compiled. With the exception of MRI, all current implementations of Ruby are compiled. (And there are actually not one, but two JIT compilers for MRI.) With the exception of JScript, all current JavaScript implementations are compiled. Note that JScript's successor, Chakra, is compiled. Many implementations of Scheme are compiled. ELisp is compiled.
-
David Thornley almost 14 yearsCommon Lisp is not what I usually think of as a scripting language, but it does have a full-strength
eval
function. -
adf88 almost 14 yearsthat was bumptious and off the topic, -1
-
Joschua almost 14 years@Antony Carthy this is wrong. Python isn't a scripting language usually, but it can be, like any other language, that is used within a programm (like Word (VB), Browser (JS))
-
Roman A. Taycher over 13 yearsThere are several techniques to compile ruby to machine code although I'm not sure if any of those don't just bundle the interpreter with string representing ruby code, but even if that were true a ruby to machine code translator can be made.Compiling it to machine code wouldn't make it anywhere close to c speed due to all the dynamic dispatch and gc among other things. I don't think there are any ruby processors but have been machines designed to more closely fit the lisp model and processors which ran java bytecode.
-
Roman A. Taycher over 13 yearsJava can technically be implemented in anything technically as its a language standard not an implementation, The main sun/openjdk implementation is in c++ with some assembly.
-
n611x007 almost 12 yearsSo what about languages like Python? It's not easy to tell where the focus is, but one could say it's focusing more on own applications, still it's often called a "scripting language". Maybe because the hidden compilation into bytecode of the reference CPython impl. doesn't raise compilation errors regarding "type safety"? Maybe Oded's answer has these...
-
anatoly techtonik about 11 yearsEven with -(1+1) it gets about 2x +1s than a checkmarked one. :D
-
bug almost 11 yearsBytecode and type systems don't really have anything to do with it. By the above definition, if an app exposes an API to Python, it is said to use Python as its scripting language. If you build an app entirely in Python, that app uses it as a programming language.
-
iconoclast almost 11 yearsBest. Answer. EVAR!
-
HoKy22 over 10 yearsIt's a very good explanation, but I am sure some people upvote it because they see "porn"
-
nomen almost 10 yearsSome of this answer is silly. A language is "object oriented" when it is oriented to programming with objects. A language is "functional" if it has first class functions. That doesn't mean a language can't be both. These are characteristics of languages, not definitions of types. Scripting is similar. A language is a "good scripting language" if it makes it easy to write scripts -- short, simple bits of user-application interaction.
-
nomen almost 10 years"Scripting" isn't a definition of a type of language. It is a characteristic that languages can have. So, Python is a "good scripting language" because it makes it easy to write code that scripts things. Assembly is not a good scripting language because it makes it hard to script. C is somewhere in the middle, because although it has a keyword (system) for calling out, it also saddles the user with lots of cruft before you can get there.
-
Quazi Irfan over 9 yearsLink to the paper is broken.
-
Admin almost 9 years+1 For """people consider a language a scripting language if they can easily write some quick throwaway programs in them without writing much boiler plate""" definition. However debatable, it is very pleasant and intuitive.
-
D A Vincent almost 9 yearsIt is interesting that this answer introduces the idea of a 'hard' language. Does 'hard' need a definition in this context?
-
D A Vincent almost 9 yearsI don't want to denigrate Peter's answer, but can we add more than opinion?
-
D A Vincent almost 9 yearsCan you shorten this answer? I think mentioning Osterhout was good.
-
Amadan almost 9 years@DavidVincent: I probably should have meant "harder". No formal definition is necessary, the intuitive understanding should suffice: it is much harder to write a program in Assembly or C than in Ruby or Python, given that the former are much more low-level and verbose than the latter.