Turns out, it works! Changes to Joose itself were minimal:
- The .NET compiler actually spotted possible errors in Joose, which were easily corrected
- While overriding toString seems to be possible, the JSC compiler complains about it when you do it too obvious :)
Although there is a global object in JScript .NET, it doesn't have a name so you can't easily set new properties on it. Joose, however, wants to create new global objects when you make a module or class, so it needs this functionality. Turns out, it is quite easy to make it available:
When you execute a function declared in global scope, the 'this' variable refers to the global object, so you can assign that to a variable to make it available to the outside world. Here is a example that is using the name window for the global object (just like it is called in the browser):
var window;You are invited to try it out. You need to checkout Joose from SVN and then go to the directory playground/jscript.net/. The file test.bat will execute all the test files from the testsuite. You will need to have jsc (the JScript .NET compiler in your path) which is part of the .NET framework in your path.
window = this;
There will be some crashes during the test run. These are all related to the JSON library which is used inside Joose.Storage. All other tests run though, so Joose should be very usable.