post your favorite scripting language

sma thanks for the very detailed discription of some popular scripting languages! very useful! :slight_smile:

So, you gain “nothing” with beanshell and the like? :slight_smile:

The only thing I want is a higher turn over rate. “Zero” delay and no need to restart your app or to reload any resources. That’s the biggest advantage. A 100% java-ish language can be also turned into usual classes at the end, which is imo a much bigger advantage than a less restricted syntax. (I personally don’t mind a bit more typing work… it only accounts for like 0.05% of a project’s time.)

In that case maybe pnuts would also be a good choice. Like sma said it’s benchmarked as the fastest scripting language for the JVM…

Well, if that is all you’re interested in, you of course gain something. However IMHO that’s enough. And it’s not about typing, it’s about abstraction. In Java (and Java like scripting languages) you can’t create your own constrol structures. You can’t do meta-programming. You can’t really use other programming paradigms but procedural (with a little bit of OO).

Let’s say you want to implement an AI. Wouldn’t it be cool if you could express the game rules really as rules as with typical expert systems? Wouldn’t it be cool if the AI could learn something by constructing new rule objects and adding them to its code base?

What’s the right abstraction to express things like these statements: Weapons wielded by a hero damage monsters. A sword does only 1 point of damage against a skeleton. If an armor has a ward against axes, no axe attack will harm the wearer. “if” statements spreaded all over the code are are IMHO not the answer. Multimethods or prolog-like rule systems could help, I think.

Stefan

Rubbish - been there, done that - in pure java! This is typical development: you write the libraries you need for the job you are about to do; if you instead simply went through life assuming the best way to write your code was always just to use the basic language syntax you’d never be making much use of e.g. OOP.

You have a point, but you’re not saying it well; java is very like C++ - it’s a systems language where you can do pretty much anything you want, allowing you to easily recreate most languages inside it. C++ makes recreation of other languages easier and with less overhead (although java does cut out a lot of the excess overhead at runtime, of course, sometimes IIRC more than C++ is able to cut out by clever compile time optimizations) - but at the cost that it has fewer language invariants and has outdated concepts hardwired, which make development slow.

…so java inherits C++'s great problem: it takes time to write those libraries. You cannot build an argument on java having the “wrong” abstraction, rather you should be compairing the amount of time it takes to get java to work in the abstraction you wanted (this is just implementation time).

“A loose term for any language that is weakly typed or untyped and has little or no provision for complex data structures. A program in a scripting language (a “script”) is often interpreted .” c.f. http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?Ousterhout’s+dichotomy

Your statement about interpreters is specious: every langauge is interpreted (think about it…).

That’s like saying “C++ is crippled without a computer”. Um, yes. C++ doesn’t exist without a computer; likewise Java.

As I mentioned, bsh is actually quite fast (a LOT faster than that - typical for me is 5 to 10 times slower), but there’s a bug which if you trigger it somewhere in your script it will result in a massive massive slowdown (somewhere around 100-500 times IIRC). So, I would guess you’re hitting that bug regularly :frowning: ?

I’ve written entire apps that haven’t triggered it, and others that triggered it straight away. I don’t know what it is - perhaps a screwed-up class-load call or something? Perhaps a reflection call that iterates along a massive chain of classes before finding what it’s looking for?

In some ways, that unpredictability is worse than being slow-and-predictable :frowning:

I know, that’s why I said it. :wink: Some people only think of scripting languages as interpreted languages, when in fact every language is intepreted (so we just proved the same point :P)

You seemed to be saying that since java has an “interpreter” (the JVM) it is a scripting language - which is not true. It is neither a scripting language (in any sense of the word) nor does it even have an interpreter, as such - the JVM is java.

I didnt mean to make it seem like I said java was a scripting language, becayse that’s not what I was gong for ;).I was mentioning how other people classify Java as a scripting language (not to mention the n00bs that utterly confuse Java with JavaScript)

Well, loops are very slow…

for(int k=0;x<50;x++)if(foo[k]==16)foo[k]=0;

That’s already a big drag…

for(int k=0;k<50;k++)for(int y=0;y<50;y++)if(foo[k][y]==16)foo[k][y]=0;

… and the framerate is down to… like 10fps with a 500mhz cpu. The same in java yields 500+fps and it’s limited by the graphic card’s fillrate.

It’s horrible slow. bsh-2.0b2… maybe I should give b4 a try, but the changelog doesn’t seem to mention any speed fixes. Ah well, I don’t really mind it’s slowness… execution speed isn’t critical for prototyping :wink:

The funny thing is, I’ve had loops that were fast - it seems to be only certain loops that are slow (what really bit us with survivor was that a loop “became” slow after some apparently trivial changes to the source :frowning: ).

I have used PHP and found it really easy to get going with - I was able to build a fairly complex site with no learning curve (but I’m a very well seasoned asp and jsp developer so the concepts involved were very familiar) but it didn’t force me to think in new ways.

I have used ActionScript a lot and it is better than Macromedia’s other language, Lingo. Better in the same way that having your eyes surgically removed is better than having them poked out with a white hot fork…

The scripting languages I really like are the ones that really take advantage of the benefits of being a scripting language rather than just trying to replicate the functionality of a compiled one- Python and Ruby do this to some degree but it’s Lisp I want to learn. I’ve started working my way through Paul Graham’s book and it is a completely different way of thinking about programming- I can see it changing the way I look at writing code and I think when I understand Lisp I will be able to call myself a good programmer…

Jython is ugly? To embed? Or you don’t like the Python language? Can’t say I’m that impressed by the Jython source, but the more I’ve used Python, the more I like it.

Na… embedding is easy. It’s generally quite easy to embed a scripting language in java. I just personally don’t like python’s syntax very much.

http://www.artima.com/lejava/articles/beanshell.html

(new interview with beanshell’s author that will probably be interesting to non-bsh-users)

PS: Significant whitespace is the spawn of the devil :stuck_out_tongue:

Java.

Seriously, I can dynamically load code at run-time. Thats the only “scripting” type feature I find useful.
Java is plenty high level for me. And Im convinced I could teach any “scripter” how to use what they
would need of Java to write game scripts as fast or faster then I could teach them any other language.

And how would you compile those .java files to bytecode when the program is being executed?

Janino is a good dynamic compiler, but oNyx says it fails under alot of code…

DP

I guess in most cases when scripting is needed, you can assume the scripts are made during development of the game and thus the script developer has the JDK installed and will use javac or even an IDE like eclipse.

The same way servlets do in many servlet containers.

I’d invoke the compielr thats in the jdk classes jar. (com.sun.tools.javac)

But Erik is correct that thsi is only needed for run time self-modifying thinsg like
builder MUDs.

For almost all other game uses scripts are written and compiled at game development time.