Hi Bitli, and sorry for the delayed answer. These days we are involved in some new (and exciting!) things, which are so demanding.
Let's start with the last of your questions:
I suppose the Javascrip implementation come from a well known existing one. Would it be possibel to know which one so that we can dig for information on non PI specific matters ?
PixInsight's JavaScript engine is Mozilla's SpiderMonkey version 1.8 RC1 (the latest officially released version). I am working on an adaptation of TraceMonkey version 1.9, which is the version included in Firefox 3.6. This version includes a JIT compiler, so hopefully it will provide a significant speed boost to JavaScript scripts in PixInsight. TraceMonkey will be available somewhere during the 1.6.x cycle.
__base__ is not "documented" in Object.
__base__ is just a notational convention that I use. It could be any valid identifier, but I use __base__ to avoid conflicts with other property and function names, and because it seems quite self-descriptive. I don't remember where/when/who, but I know I saw it being used by someone and I liked it, and I use it since then.
In a construct such as:
function ADerivedObject( parent )
{
this.__base__ = AParentObject;
if ( parent )
this.__base__( parent );
else
this.__base__();
...
}
I use __base__ to force ADerivedObject to have a property of type AParentObject. Then I execute AParentObject's constructor inside ADerivedObject (the call to this.__base__()). By doing that I force ADerivedObject to inherit all methods and properties from AParentObject. This is a standard inheritance implementation technique in JavaScript, where as you know object orientation is prototype-based, in contrast to other OO languages such as Java and C++, where the OO model is class-centric.
results in error as setText is not recognized.
Hmm. Your code seems correct, and it works fine for me. This is the proof of concept:
function FileToAlignTreeBoxNode( parent )
{
this.__base__ = TreeBoxNode;
this.__base__( parent );
this.serendipitously = function()
{
console.writeln( "serendipity!" );
};
this.foo = "foo";
}
FileToAlignTreeBoxNode.prototype = new TreeBoxNode();
var tree = new TreeBox;
var node = new FileToAlignTreeBoxNode( tree );
node.setText( 0, "test" );
console.show();
console.writeln( node.text( 0 ) ); // should write "test"
console.writeln( node.foo ); // before assignment: "foo"
node.foo = "bar";
console.writeln( node.foo ); // after assignment: "bar"
node.serendipitously();
Let me know if this code works as expected; I've just checked and it does work fine on PI 1.6.