in reply to At Last, a Useful Definition of "Scripting Language"

This strikes me as rather strange. I know "interpreted" and "script" are used interchangeably now, but it seems to me the idea of a script is that it is a human-readable code. Like the script of a play.

If, from the user's point-of-view, the human-readable code appears to be executed, you have a scripting language. Take the most common form of Perl: a text file which appears to be run as a binary. Even though it's really being compiled into bytecode and interpreted at runtime, it looks like the human-readable code is being executed. In other words, compile and run are one step.

"Interpreted" is like Java -- the command you execute is a file containing bytecodes which are not human-readable. But those bytecodes are interpreted into native machine code at execute time.

"Compiled" is like most C programs -- the command you execute contains the machine code.

Perl is primarily a scripting language, but since you can compile into bytecode using pp or similar, it is really an interpreted language as well. Overlapping is allowed, you know...

Yeah, there's plenty to debate about those definitions: there will be for any definition. But, the above create divisions which are helpful for knowing what someone means -- when I say "I wrote a script", I mean that the source is the program, and that's how it will be distributed.

radiantmatrix
require General::Disclaimer;
"Users are evil. All users are evil. Do not trust them. Perl specifically offers the -T switch because it knows users are evil." - japhy
  • Comment on Re: At Last, a Useful Definition of "Scripting Language"

Replies are listed 'Best First'.
Re^2: At Last, a Useful Definition of "Scripting Language"
by hardburn (Abbot) on Oct 27, 2004 at 18:39 UTC

    That might be a logically-consistent definition, but it isn't a useful one. I can write a program that will take C code and interpret it on the fly. Would C then be a scripting language?

    By this definition, the only difference is in how it's implemented. It doesn't cover how you use the language. Now, a language that is meant to be interpreted is often optimized for running in an interpreter, and likewise for compiled langs, but it is still possible to implement it the other way.

    So I reject that definition on the grounds that it doesn't make a smeg of practical difference.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      That might be a logically-consistent definition, but it isn't a useful one. I can write a program that will take C code and interpret it on the fly. Would C then be a scripting language?
      That's why that definition is useful, because there is overlap, and because it defines a language based on how it can be used. In the case you cite, you'd have an environment (your interpreter) in which C was a scripting language. Just like in csh. C can be a scripting language in some environments, and a compiled language in others.

      Similarly, Perl can be a scripting language or an interpreted language, depending on how it is used.

      Now, a language that is meant to be interpreted is often optimized for running in an interpreter, and likewise for compiled langs, but it is still possible to implement it the other way.
      Exactly. The problem is that languages might have been destined for one type of use, but evolve into another type of use. Imagine a language 'X': it is designed by its original architechts to be a scripted language. Someone finds it very useful, but wants to be able to distribute the language in machine-code form so that the interpreter need not be shipped with the product; so, they build a compiler for 'X'.

      Now, 'X' is a scripting language -- it was clearly designed to be that way. However, it is also, now, a compiled language.

      So I reject that definition on the grounds that it doesn't make a smeg of practical difference.
      Outside of academia, languages need to be useful above all else. Useful languages eventually get modified and built upon until they become "all things to all people". Creating arbitrary lines and saying "this language is a scripting language because $arbitrary_reason" will never make a whit of difference.

      The only useful description of a language is one that gives you an idea of how it can be used. If you use my definitions, saying "Perl is both a scripted and interpreted language" actually conveys useful information. It tells me that I can run Perl programs as scripts or as bytecode-compiled binaries. That gives me a vague idea of what Perl is capable of. It gives me a clue that Perl will require an interpreter of some kind; and, that means it will have certain pros and cons.

      radiantmatrix
      require General::Disclaimer;
      "Users are evil. All users are evil. Do not trust them. Perl specifically offers the -T switch because it knows users are evil." - japhy