yozzeff thinks

musings about programming

Montag, Dezember 27, 2004

Choosing a Scripting Language for the JVM (Part I)


So if you haven't lived somewhere in a cave for the last few weeks you might have noticed quite some discussion about the usage of languages other than java (the language) for the java virtual machine (JVM). I have been looking for a scripting language for over a year since i have quite some pains to ease.

Use Cases


My main reason for the usage of a scripting language is that i want an easy way for defining (declarative) small languages.
usually the response to that request is: why don't you use XML?
Actually our modest sized project (100k+ LOC java) is using XML (120k+ LOX) for that. And honestly it sucks! I had enough! I can't stand it any longer!
It hurts my eyes as well as my brain.
XML lacks (at the moment) any decend way for breaking up huge files into components. XInclude has been finalized only last week and there will be no implementations for quite some time (yes i know about elliots XOM, but that would force me to rewrite a great chunk of our existing code base)
XML lacks a variable concept - no really i don't want to solve that problem by using a even more complex and verbose technology (XSL).
And finally sometimes it is necessary to have an escape route out of the declarative approach. Again XLST is no solution to that.
So what i want is:

  • A concise syntax

  • Declarative look & feel

  • Variables

  • A way to modularize files

  • Fallback to a procedural way of definition instead of declarative


Let's have a look on an example of what i want to do:


foo = "AFOO"
bar = "BAR"

Parent
child(foo)
child("a_new_foo")
grand_child(bar)
include("/foo/bar/module1.mod")
child("something different")
include("/bar/foo/module2.mod")

Indention is important here as it describes parent-child relation ship. Include would mean expand the content of the file referenced right here.
So which language would be the best (nearest in syntax and semantics)?

Contenders


there were 3 contenders for a scripting language i was looking at

  • Jython

  • Groovy

  • JRuby


Of course there are quite some more languages for the JVM

1 Comments:

At 1:30 nachm., Blogger alexa18myra said...

damn good blog, check out mine http://juicyfruiter.blogspot.com, comments always welcome!

 

Kommentar veröffentlichen

Links to this post:

Link erstellen

<< Home