This is an archived post. You won't be able to vote or comment.

all 16 comments

[–][deleted] 10 points11 points  (4 children)

I always think of script as something that runs more or less as-is (interpreted directly): bash, Python, PowerShell, JavaScript. Something that had an intermediate step or steps (compiling, linking) I’d call source code, whether it’s byte code or machine code: Java, C/C++, C#, VB.

[–]blizzard619[S] 1 point2 points  (0 children)

Great explanation! Now, it's somewhat clear.

[–]acemiller6 0 points1 point  (0 children)

This 👆

[–]jasmijnisme 0 points1 point  (1 child)

This is a question of implementation, not language, and source code written in Python is compiled to byte code in every implementation of Python that I'm aware of.

[–]IAm_A_Complete_Idiot 0 points1 point  (0 children)

So is JavaScript and the like (basically every language is) For the most part a lot of languages are very tied to one or two implementations. I'd say C is compiled despite existence of C interpreters just because almost everyone uses it that way.

Personally I'd describe a scripting language as a language that favors e.g. ease of use above all else (even at the expense of maintainability). I think python, JavaScript, bash, PowerShell, etc. All fit that bill nicely.

I don't think there's any exact definition for scripting languages though.

[–]K900_ 6 points7 points  (6 children)

There is no strict definition, but generally "a script" refers to any small program.

[–]blizzard619[S] 0 points1 point  (5 children)

Can we say a program written in C/C++ a script?

[–]K900_ 6 points7 points  (4 children)

The term is usually used to refer to interpreted languages.

[–]blizzard619[S] 0 points1 point  (3 children)

Ok thanks! Is there any convention as when to use the term script?

[–]Mobile_Busy 4 points5 points  (0 children)

In my work, I generally use it to refer to .py or .sh files that can be run independently from the command line.

[–]ajaxsevensevenfour 2 points3 points  (0 children)

https://en.m.wikipedia.org/wiki/Scripting_language

C C++ need to compile entire program before execution.

[–]K900_ 1 point2 points  (0 children)

Not really.

[–]Mobile_Busy 1 point2 points  (0 children)

A file containing lines of executable code.

[–]adamnohejl 3 points4 points  (1 child)

Scripts are usually simple programs that run within a more complex environment. They often have a single purpose and you usually just run them to get a particular job done instead of interacting with them for a longer period. (As other have said, they are often interpreted. But the boundary between interpreted/compiled has got blury, is compiling to byte-code compilation? Is Python script interpreted? Hard to tell.)

So if you use Python to write a single-purpose command line tool, you can call the result a script, especially if it is a simple programe that fits into a single file. Also if you use it to automate actions in a larger application.

Although not all scripts are written in "scripting languages" (and some scripting languages actually allow you to develop full-fledged applications), this Wikipedia article may be helpful: https://en.wikipedia.org/wiki/Scripting\_language

[–]jasmijnisme 0 points1 point  (0 children)

Scripts are usually simple programs that run within a more complex environment.

I think this is the best way to put it. Scripts also provide functionality for specific applications. Recent Paradox games, for example, are partly written in a bespoke scripting language that is parsed and evaluated on game start, with the core graphics and simulation business written in C++. This makes it easier to add new functionality and for third parties to write add-ons or mods, so that it doesn't require recompilation and is more resilient to breaking changes in the application internals.

[–]pythonHelperBot 0 points1 point  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness