📜 ⬆️ ⬇️

Saltarelle: open source C # - JavaScript compiler

Good day. Our team (without references, it does not matter) decided to try the new Saltarelle compiler tool in developing its project and, as Habr often helped us with useful information, we decided to make a modest contribution to his knowledge bank and translate the blog entry to the developer.

Transfer


I have been developing web applications for a long time. Somehow, in ancient times, I was looking forward to the decision of my employer regarding the transition IE3 -> IE4, so that I could finally use the new function of adding rows to a table, which was then called DHTML. Subsequently, Remote Scripting appeared, read Ajax (only 8 year old leaven) embedded in IFRAMEs or Java applets. Over all these years, I realized that Javascript is indispensable for creating small features like form validation or dynamic text management, but it is poorly suited for developing complex systems. Of course, you can write a great and great system in Javascript, you can just as well develop an analog computing device for artillery fire control ( Eng / Eng ), and I am convinced that you should not use tools that have more suitable solutions alternatives. In 2007, or so, I came across Script # - a project that generated Javascript based on C #. I have often used it for the last few years, the idea is excellent! After all, it allows you to use all the C # buns in web development: ReSharper, IntelliSense and you will never see the error “the object does not support this property”. However, unfortunately, the development of Script # has been discontinued and it seems that not a single new feature has been added in the last 3 or more years.

When .net 3.5 appeared, it did not support implicitly typed variables or lambda expressions (actually a lot of other things) and, although not bad, was outdated. Moreover, its use in client-side programming is much more annoying than on the server side. But now it is in the past. About a month ago I finished the Saltarelle compiler. It was conceived as a replacement for Script #, only with almost full support for C # 4. Why almost, see below:


')
Or by reference . If the feature is not specified, then it is almost certainly supported (unless it is some kind of non-explicit). And my open source library! Over the past weeks I have finished it and now it is stable and can be used. Here is a link to the Getting started guide (Eng) for those who are new to the idea, but a link to the guide for migrating (Eng) for those who want to migrate with Script #.
I do not think that the tool is universal, but if you are developing a “thick” HTML application (especially, but not necessarily, if you write the server part on .net), then it will greatly facilitate your life.

License


The project was published under the Apache License 2.0 , it is permissive (Eng), i.e. no problem can be used in any projects, whether commercial or not. The reason why this license is used is that I used the library, the author of which is Nikhil Kothari, and not me.

Source: https://habr.com/ru/post/151014/


All Articles