Home » News » Script#: JavaScript/Ajax for t ...

News by JavaScriptSearch


Script#: JavaScript/Ajax for the C# Developer

 

JavaScriptSearch
Thursday, May 25, 2006; 02:30 AM

A prototype technique for generating JavaScript from C# code was announced by senior Microsoft software engineer Nikhil Kothari. The Script# compiler, together with sample projects, is available for download at http://www.nikhilk.net .

"The fundamental goal was to improve the state of the art in scripting," says the author about his pet project. "This goes way beyond the usual things that come to mind at first thought: compile-time checking, and intellisense or statement completion. I do think these are super-useful, and would be valuable in and of themselves. As we worked on Atlas we were also thinking of a great tools experience, and we explored different approaches and technologies for achieving this. Script# is a prototype of one such exploration. It attempts to address some programming environment requirements:

    * A clean language with the natural constructs. Today with script, you can go a long ways in simulating OOP (classes, interfaces, inheritance etc.), but the simulations are thrown at the face of the developer. Various C# constructs such as properties, events, and syntax for defining inheritance go a long way in making the code readable. Similarly modifier keywords like public vs. protected vs. internal, sealed vs. virtual etc. help define a better object model. All of this can be brought into the scripting world.
    * Easier refactoring and exploration. Script development could benefit immensely from the refactoring, and class browsing support already present in the IDE and in tools such as .NET Reflector. Both lend themselves to having a more manageable code base over time.
    * Ability to generate documentation. Again doc-comments from C# and the existing infrastructure could be leveraged here.
    * Ability to customize the script code easily. For example, I'll show debug vs. release and minimization below. The same idea could apply to building a version of the script that had more error checking or logging built in when you do need to run diagnostics. The approach could also be used to include instrumentation for the purposes of profiling, measuring code coverage, etc. Another interesting aspect of this project is that it will be able to generate script catering to multiple script profiles such as the current Javascript language, as well as Javascript 2 when it appears."

 

 Script# in action.

The announcement of Script# came shortly after Google's release of GWT, a Java framerwork for writing Ajax apps.    

Advertisement

Partners

Related Resources

Other Resources

arrow