To properly set up the prototype you need a little more [...]
This is what I'm doing now. My problem is that then, the `constructor'
property still isn't set correctly and hence the `instanceof' operator
doesn't work. One solution I'm considering is:
function Foo(arg1, arg2, ...) {
if (!arg.length) return; // required
// rest of code
}
function new_obj(type, args) {
x = new type();
type.apply(x, [1,2,3]);
return x;
}
x = new_obj(Foo, [1,2,3]);
But I'd love to be able to avoid that starting line inside of Foo.
Martin said:
new Foo( [1,2,3] ); // one argument, any length
I don't know if you're serious, but this is actually where I'm
leaning, if I don't figure out an elegant way of doing the former.
Cheers,
Andrey