Just wanted to let you guys know that we released a new version the JavaScript meta object system Joose which was heavily inspired by Moose.
The major new feature of this release is the support for type constraints and type coercions for attributes and method parameters. There is also experimental support for multi method. We'll see how that evolves.
The development of Joose, a meta object system for JavaScript with great similarities (and interoperability) to Moose continues at great pace. We just released a new release candidate and the release should happen today or tomorrow.
Meanwhile I started a new job at sinnerschrader (Hamburg, Germany) and we have quite a few job openings in all things software engineering. Especially if you are tired of body leasing, you might find this video interesting.
While staying in the US I got a lot of hacking time in. The first result is a new version of Joose the JavaScript meta system that should feel very familiar to everybody who uses Moose
The new feature I find most useful is the ability to add custom class builder methods:
Class("MyClass", {
methods: {
...
},
primaryKey: "id"
})
The "class builder methods" in this example methods and primaryKey are just methods on the meta class and can be freely defined and overwritten.
Secondly, I put a lot of work into blok. blok is an application build on Joose that enables collaborative editing of simple flow charts and user interface prototypes.
Back to hacking...
Development of Joose has recently focused in using it in real applications and refining the API on the go.
The most complex application to date is Blok which supports collaborative editing of user interface prototypes. Blok uses Google App Engine on the server side but almost all the code is running on the client side using Joose and jQuery (especially jQuery UI). At the core of blok lies a component system that uses roles to apply behavior to different shapes. For more information see the Joose blog..
Class("Car", {
has: {
leftRearWheel: {
init: new Wheel(),
isa: Wheel,
is: rw,
handles: "*"
}
}
})
to only allow Wheels in the attribute leftRearWheel and to delegate all of Wheel's methods to the leftRearWheel.
In other news:
Class("HTMLDoc", {
augment: {
html: function () { return "<html>"+this.INNER()+"</html>" }
}
})
Class("HTMLDocBody", {
isa: HTMLDoc,
augment: {
html: function () { return "<body>"+this.INNER()+"</body>" }
}
})
Class("TPSReport", {
isa: HTMLDocBody,
augment: {
html: function () { return "<h1>TPS-Report</h1>" }
}
})
While making method modifiers stackable was really easy for all the other modifiers, I had to roll my own reverse call stack to make it happen with augment.
Class("HardWork", {
meta: Joose.Gears,
has: {
data: {is: rw, init: {}}
},
methods: {
onDoWork: function (result) {
ok(result == 1001, "Gear Worker returns correct result")
}
},
workers: {
doWork: function (start) {
var counter = start;
for(var i = 0; i < 1000; i++) {
counter++
}
return counter
}
}
})
var hw = new HardWork();
hw.doWork(1)