Finally, Nibble is ready to support native classes. So far, the scripting engine only supported (un)compiled Java classes, and class behavior through prototyping.
The new class system is a Java like but simpler class, that utilizes prototyping behind the scene. It provides some benefits over mere prototyping though that come natural to the classic class entity:
- regular class notation, including the keywords class and extends
- private and public methods or constructors
- private and public and/or final properties
- static or instance methods/properties
- inheriting mechanism and polymorphism
- strong typing ... read more
A lot has happened since the last release... Well, the last release was some time ago, true, but it was worthwile in my opinion. Nibble has been enhanced so much that you can copy 'n paste almost any ECMAScript code (ie. Javascript or Actionscript) and run the same code in Nibblescript with some small changes (mostly variable declarations, since Nibble does this Java style).
Since this is one of the larger releases so far, I'll go into some detail regarding the new features.... read more
I've submitted the codebase of the Nibble Script Engine for analyzes. You can see the results here:
http://www.ohloh.net/projects/4580
The analyzes provides a visual map of CVS commits, codebase indication and comment indication. Nibble belongs in the top third of projects being 'well documented'!
This release is all about one new feature added to the Nibble Script Engine: the prototype concept.
Basically, it does what ECMA's prototype does, functionally
It started when Nibble needed a way to pool shared functions, for example when you made a function that creates a new Dynamic and assigns default getter/setter methods to it. Every time you called that function, a new object was made with new instances of the same method with the same parsed code statements, and this ate your memory like biscuits and it had to stop. The prototype provides this shared pool where methods are executed within a certain context (the scope, or 'this'). Incidentally, this also made it feasible to go ahead and implement OO like capability in Nibble, which is a great step forward.... read more
Nibble now lives on www.projectnibble.org!
Not only that, Project Nibble is now backed by a Wiki site (TikiWiki based), which is awesome, because small edits are extremely easy to make on the fly by anyone, and there are automated facilities for blogs, articles, FAQ, RSS etc.
Over the course of the next months, documentation on projectnibble.org will grow and I'll be reporting on everything Nibble can do or mean for you.... read more
Today's release is all about little details. Various features have been added, enhanced or moved. Also a list of bugfixes have been covered that showed up in 'real life use' of the script engine.
Among other things, one of the biggest added features is how the script engine looks for methods on a Java object, for example when you call a constructor of some class from Nibblescript; in addition to autoboxing and autocasting to supertypes, Nibble will try to match interface types as well and as last resort will try to autoconvert many common types (ie. int 5 to String "5").... read more
Nibble had some bugs fixed some features added and a complete Javadoc sweep done.
Included in Nibble v0.9.4 is a complete Javadoc for developers (private version) and end-users (public version).
Here's the changelog for this release:
- fixed for-loop so third parameter is optional
- fixed for-loop, while and do-while so local parameter stack is reset every loop
- fixed reflection bug when invoking method of public interface implemented by a private inner class
- added setter for external .java/.class classloader to search for classes that are imported in NS.
- fixed some comments
- renamed interface ILocalStack to VariableCollection and changed all references to 'local' to 'variable'
- changed thrown Exception from VariableCollection to runtime exception
- updated ALL javadoc entries and applied consistency and some semantics (<code>, {@link}, etc.)
- performed a complete (and first) Eclipse cleanup swoop
- updated DynamicMethod so that you can create inline method variables with it in Java:... read more
Nibble has had some major surgery done. Most classes have been renamed to be more sensible and various problems have been solved.
Perhaps the biggest operation was reworking how scope works in Nibble; dynamic functions now work with scope(s) correctly. Also, you can now use the keyword 'this' and stuff like that and variable/method lookup has been fixed (both tweaked for native support and dynamic language support).... read more
Well, more dynamic anyway. In addition to dynamic properties, Nibble now supports dynamic functions as well. Functions can be assigned to variables after which those variables can be called like functions.
Here's an example:
<code>
Dynamic person = new Dynamic();
person.eat = function(food) {
trace("hmm... " + food.getName());
};
Dynamic apple = new Dynamic();
apple.getName = function() {
return "apple";
};... read more
In short, the Dynamic object acts like a Javascript object, in that you can dynamically add properties to an instance. This is extremely powerful for dynamic languages like Javascript, Actionscript and now up to a point Nibblescript.
Combine the dynamic object with XML and you can get an Object representation of the XML datatree. It's a little bit like JAXB, except without the need for complex schema's, DTD's or other stuff. Plus, you don't need to generate stub classes up front (which also means memory footprints for the classes involved reduce to only one class: Dynamic).... read more
To aid in grasping what Nibble can do, a new project has joined the Nibble force: Orb.
Orb is simply a cheap version of adobe flash Flash where you can apply scripts to a 'stage' of objects. With Orb you can add Sprites to the stage and do all kinds of stuff with them; since you have access to all of Java's libraries, there are but few limits.
It's a demonstration/tutorial/practice tool to get your hands dirty quickly and see how Nibble works with scripts.... read more
Finally the sourcecode has been uploaded in neat and tidy packages, including a simple testcase to demonstrate how easily the ScriptEngine can be used quickly.
For your pleasure, here's the purest and simplest form:
<code>
import com.nibble.Scriptengine.ScriptManager;
public class NibbleTest {
public static void main(String[] args) {
ScriptManager m = ScriptManager.createManager();
try {
m.eval("System.out.println(\"Hello World!\");");
} catch (Exception e) {
e.printStackTrace();
}
}... read more
The Script engine has been dubbed 'Nibble' and has been added to the sourceforge opensource projects domain.
Source will follow soon.