When is a language considered a scripting language?

128,967

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.

Share:
128,967

Related videos on Youtube

Sietse
Author by

Sietse

Updated on July 08, 2022

Comments

  • Sietse
    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
      Kent Fredric over 15 years
      You 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
      Kent Fredric over 15 years
      stackoverflow.com/questions/98268/… There is a lot of similiarity. Not nessecarily identical, but a lot of shared context/opinion.
    • ngeek
      ngeek over 15 years
    • Sietse
      Sietse over 15 years
      I 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
      anon6439 over 15 years
      PHP is definitely considered a scripting language.
    • ivan_ivanovich_ivanoff
      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
      Admin almost 14 years
    • dmckee --- ex-moderator kitten
      dmckee --- ex-moderator kitten almost 14 years
      In 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
      Admin almost 14 years
  • Kent Fredric
    Kent Fredric over 15 years
    Even 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
    Sietse over 15 years
    So you think php, python, etc are scripting languages?
  • user1066101
    user1066101 over 15 years
    "Scripting" is a common description for Python and PHP.
  • Robert S.
    Robert S. over 15 years
    Hilarious that the accepted answer has two downvotes.
  • Joseph Ferris
    Joseph Ferris over 15 years
    There should be some sort of badge for that. How about "Can't handle the truth."? Nah, a little too wordy. ;-)
  • anon6439
    anon6439 over 15 years
    No 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
    Jacob over 15 years
    Perl compiles to byte-code before it runs.
  • Jacob
    Jacob over 15 years
    Static / Dynamic, there are dynamic languages that are compiled.
  • Robert Gould
    Robert Gould over 15 years
    I 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
    PhiLho over 15 years
    Mmm, 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
    mthurlin over 15 years
    You 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
    anon6439 over 15 years
    They are. Scripters, that is.
  • Eineki
    Eineki over 15 years
    What about Java? You need a jvm to run a java program but I wouldn't call it a scripting language
  • Jonathan Leffler
    Jonathan Leffler about 15 years
    Perl, Python, Ruby, Tcl/Tk - to name but four scripting languages - are not primarily built into a larger application.
  • Milen A. Radev
    Milen A. Radev about 15 years
    Ergo - they are not scripting languages.
  • Antony Carthy
    Antony Carthy almost 15 years
    php and python - of course they are scripting languages!
  • Roberto Bonvallet
    Roberto Bonvallet almost 15 years
    Yeah. "It's not a 'toy language', it's a 'high-level language'" :P
  • Admin
    Admin over 14 years
    this is what my definition has been since the start
  • Paul Biggar
    Paul Biggar over 14 years
    This doesnt answer the question at all!
  • Paul Biggar
    Paul Biggar over 14 years
    Java hasn't been interpreted in a long time.
  • Noon Silk
    Noon Silk over 14 years
    Uh yeah, it'd be nice if this could be unmarked as correct somehow.
  • Stefano Borini
    Stefano Borini over 14 years
    @psoul: yes. so is java.
  • user3629501
    user3629501 over 14 years
    Let 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
    Admin over 14 years
    This 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
    Paul Biggar about 14 years
    That is an interpreted language. If you are trying to say that any interpreted language is a scripting language, say that.
  • user3629501
    user3629501 about 14 years
    Well, 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
    Donal Fellows almost 14 years
    Just so you know, Java's implemented in C++.
  • Amr Elgarhy
    Amr Elgarhy almost 14 years
    hmmm, so what about javascript? is it programming or scripting?
  • Laz
    Laz almost 14 years
    thats it? but every interpreted language is not called a scripting language. I'm still confused!
  • sepp2k
    sepp2k almost 14 years
    @Amr: Well it is called javascript
  • Oded
    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
    Amr Elgarhy almost 14 years
    @sepp2k so its not programming language?
  • Oded
    Oded almost 14 years
    @Ram Bhat - it is confusing, as the distinction is artificial.
  • Laz
    Laz almost 14 years
    you guys are giving examples..I'd like to know WHAT would classify a language as scripting language? other than compiled and intepreted
  • Andrey
    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
    Laz almost 14 years
    hmmm.. 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
    Jörg W Mittag almost 14 years
    @Andrey: All modern JavaScript implementations are compiled. And there are interpreters for C.
  • Quentin
    Quentin almost 14 years
    @Jörg +1 and this is what brings us back to the distinction being useless.
  • mouviciel
    mouviciel almost 14 years
    What about Objective-C ?
  • Laz
    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
    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
    Clinton Pierce almost 14 years
    And 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
    Timo Westkämper almost 14 years
    It supports dynamic typing, but I wouldn't call it a scripting language.
  • Jörg W Mittag
    Jörg W Mittag almost 14 years
    This 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
    Laz almost 14 years
    Thanks.. 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
    Jörg W Mittag almost 14 years
    This 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
    Jörg W Mittag almost 14 years
    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.
  • wlangstroth
    wlangstroth almost 14 years
    No, 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
    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
    FrustratedWithFormsDesigner almost 14 years
    @Will: any distinction would be artificial. This was my opinionated distinction. ;)
  • wlangstroth
    wlangstroth almost 14 years
    yeah, 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
    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
    Jörg W Mittag almost 14 years
    Actually, 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
    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
    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
    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
    Jörg W Mittag almost 14 years
    Are 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
    David Thornley almost 14 years
    Common Lisp is not what I usually think of as a scripting language, but it does have a full-strength eval function.
  • adf88
    adf88 almost 14 years
    that was bumptious and off the topic, -1
  • Joschua
    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
    Roman A. Taycher over 13 years
    There 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
    Roman A. Taycher over 13 years
    Java 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
    n611x007 almost 12 years
    So 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
    anatoly techtonik about 11 years
    Even with -(1+1) it gets about 2x +1s than a checkmarked one. :D
  • bug
    bug almost 11 years
    Bytecode 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
    iconoclast almost 11 years
    Best. Answer. EVAR!
  • HoKy22
    HoKy22 over 10 years
    It's a very good explanation, but I am sure some people upvote it because they see "porn"
  • nomen
    nomen almost 10 years
    Some 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
    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
    Quazi Irfan over 9 years
    Link to the paper is broken.
  • Admin
    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
    D A Vincent almost 9 years
    It is interesting that this answer introduces the idea of a 'hard' language. Does 'hard' need a definition in this context?
  • D A Vincent
    D A Vincent almost 9 years
    I don't want to denigrate Peter's answer, but can we add more than opinion?
  • D A Vincent
    D A Vincent almost 9 years
    Can you shorten this answer? I think mentioning Osterhout was good.
  • Amadan
    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.