Tag Info

Hot answers tagged

65

When you have behavior that you don't want to have to recompile the program in order to change. This is exactly why so many games use Lua as a scripting/modding language.


43

I did this, and I recommend that you don't. What I did was write all the business logic in Lua, and stored that Lua script in a database. When my application started up it would load and execute the script. That way I could update the business logic of my application without distributing a new binary. I invariably found that I always needed to update the ...


36

I would argue that a scripter is a programmer, scripting languages are still programming languages :). Some will argue that you're only a programmer once you've picked up your first non-scripting language. Your Mileage May Vary comes to mind here. Some will also argue that a scripter has no formal methodology/training behind them, in that case those ...


35

Piping dynamic data into an interpreter of your implementation language is usually a bad idea, since it escalates the potential for data corruption into a potential for malicious application takeover. In other words, you are going out of your way to create a code injection vulnerability. Your problem can be better solved by a rules engine or maybe a ...


32

None. Scripting languages ARE (a subset of) programming languages. From Wikipedia: 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 ...


29

Simple : Lua have more "niche" objectives than Python. Python is thought to be useful as a general programming language. So, it's useful in a lot of cases. It covers many well known types of application but doesn't enter directly into competition with other languages that might be targeted at specific constraints, but the simplicity of it's syntax. Lua is ...


28

This technique can be used to implement core logic that is easily portable between different language environments. For example, I have a calculator simulator where all the internal calculator logic is implemented in 100% JavaScript. The user interface code is of course different for each platform: Web browser (JavaScript) iOS (Objective-C) Windows (C++ ...


25

I disagree. First, scripting languages are at a higher level of abstraction, and there is nothing wrong with this. At the beginning one is just trying to learn the principles. Actually I would say that choosing a lower level language may encourage bad coding, since one has to deal with some details before being able to understand them. Instead with a simpler ...


22

The main difference is in how they are used. Scripts are typically quick and dirty. Say, a bash script to make your life easier. Whereas a 'programming' language is meant to be much more thought out and deliberate. That's not to say that you can't do that with a 'scripting' language. You can make full-blown GUI applications (or web app) with python as ...


21

There's certainly no technical reason such a thing couldnt exist. There's nothing particular about client-side code that mandates the use of dynamically typed languages.


21

It doesn't matter where you start. It matters where you go after you start. BASIC may not be the most elegant language on the planet, but it encompasses the fundamentals of procedural programming, and that's enough to get started. I started with BASIC. I didn't stay there.


19

Let me attempt to find a dividing line between these three types of language. Of course, there will be numerous exceptions and counterexamples, since this is just my opinion. A markup language is used to control the presentation of data, like "represent these user names as a bullet list or as a table". A scripting language is used to mediate between ...


18

Very broadly there are two situations where you would apply this pattern: This is used internally to leverage some quality of the embedded language. This is used to provide external programmability. Internally Typically the embedded language is interpreted which allows changes to be made and tested quickly without a re-compile. The embedded language ...


16

Since it's highly unlikely that another language will find broad adoption, your best bet would be to create a statically typed version of JavaScript (i.e. a language close to java) and a preprocessor that converts that to normal JavaScript. For example, your script looks like that: <script type="text/staticjavascript"> String foobar(int foo, ...


16

What you need to write is called a language specification. It should contain a description of the language's grammar (preferably in Extended Backus-Naur-Form) and its semantics. For the latter part you could either write a description in your own words (but take care to be precise) or a formal semantics.


15

bash has been around since 1989, and its syntax is largely compatible with that of the much older Bourne shell, which was released in 1977. Huge swaths of core functionality in many operating systems (most Linux distros, OS X, and indeed most POSIX-compatible operating systems), and many real-world systems (make systems, automated tests, initialization ...


14

A $ sign in variable name is a special case of "Sigil", Back in the early days of BASIC (1964 or so) $ was used to denote string variable names. My guess is, since it makes it easier on compilers to separate variable names from the rest of the grammar using some symbol, and since it was common to BASIC, its usage has progressed. However, this is not the ...


14

It's not just a bad idea. It's pretty much impossible. How do you implement IO with a language whose IO facilities depend entirely on the host operating system? How could you implement primitive scheduling without any useful interrupt primitives? How could you write a device driver in a language which cannot address a particular byte? Edit:-- Just to ...


14

A "script" is a set of instructions that do something the user could do themselves, only faster and with less possibility for error. Sure, I could delete all my old log files manually, but the script Bob wrote does it just fine. An "application" or "program", in contrast, is an automated or interactive bit of software that can be thought of as doing ...


13

Generally the difference is that a "scripter" is writing scripts as part of some other process (IE, for batch processing, or for running backups), whereas a programmer is actually writing a complete application of some sort. The language is really irrelevant. The scripter is just writing "quick and dirty" scripts in order to get a job done, whereas a ...


13

Scripting languages are programming languages. The idea that the two types are separate ("versus") comes from people who are trapped in the mindset that a language cannot be both convenient and powerful. Mostly, these people have a C or C++ background, and they've worked hard to stay as close as possible to their language of origin (Java, C#). It's natural ...


13

It depends on what code is in the include file. Did you try putting the #include for <stdio.h> inside main()? Depending on how the standard library is implemented on your system it may not even compile. Header files can contain not only function declarations, but function definitions. Standard C doesn't support nested functions. If your header file ...


12

You will need the following: A reason for creating a new language A Philosophy A Semantic Definition A lexical description of your tokens A Syntax Analysis definition How will your language be different? What is its mission? Is it functional? Is it object orientated? Is it a meta-language? What are its unique features? What will it give the world ...


12

Scripting and Programming is not how you classify languages. Scripting and Programming is how you classify what you are doing with the language. But in the end , these are loose and overlapping classifications.


12

Yes! You definitely can do that with Node.js or Rhino. For example the coffeescript compiler is nothing but a node.js script. I will admit that it is not generally my first choice for desktop scripting but I see no reason why it would not work quite well for a number of tasks.


12

Consts are good for just giving descriptive variable names to avoid the magic number problems, but they cause a similarly annoying problem of not being able to identify the value actually being used when the const is defined away from it's use. My suggestion, in all languages: define consts in as close a scope as possible to their actual usage. If used in ...


11

Python is pretty easy to embed and has good documentation on how to do it. Also, Python has a pretty approachable syntax, even for new users. Perl tends to have obtuse syntax making it less approachable for new users. Another common language for embedding is Lua. It is known to be fairly easy to embed and has low operating overhead. Python is well known ...


11

Python. Period. Google has very good introductory lectures. EDIT Why? Because Python is: Easy to understand for beginners Scalable (can be used for developing small AND large project) Portable Cross-Platform Object-Oriented Simple FUN


11

Ousterhout's article1 about scripting languages suggests that the higher level the programming takes place, the more productive the programmer is. If we take that, as Boehm says2, the number of lines a programmer can write in a given time is constant and not dependent on the language or its type (low level, system programming, scripting), one can easily ...


11

Your teacher is correct, except that he assumes that his consequences are bad things. If you look at learning languages as purely an academic activity to learn how computers work, then he is correct. If you look at them as a way to get things done then you are correct.



Only top voted, non community-wiki answers of a minimum length are eligible