Topics

Featured in Development

Peter Alvaro talks about the reasons one should engage in language design and why many of us would (or should) do something so perverse as to design a language that no one will ever use. He shares some of the extreme and sometimes obnoxious opinions that guided his design process.

Featured in AI, ML & Data Engineering

Today on The InfoQ Podcast, Wes talks with Katharine Jarmul about privacy and fairness in machine learning algorithms. Jarul discusses what’s meant by Ethical Machine Learning and some things to consider when working towards achieving fairness. Jarmul is the co-founder at KIProtect a machine learning security and privacy firm based in Germany and is one of the three keynote speakers at QCon.ai.

Featured in Culture & Methods

Organizations struggle to scale their agility. While every organization is different, common patterns explain the major challenges that most organizations face: organizational design, trying to copy others, “one-size-fits-all” scaling, scaling in siloes, and neglecting engineering practices. This article explains why, what to do about it, and how the three leading scaling frameworks compare.

DuoCode Uses Roslyn to Transpile C# into JavaScript

DuoCode is a C# to JavaScript compiler that promises to allow developers to build HTML5 applications using C# and the .NET framework inside of Visual Studio. InfoQ has interviewed its creators to learn more.

DuoCode claims to support a number of C# features, including strong-typing, class-based inheritance, reflections, generics, lambda expressions and Linq. Other advantages that DuoCode should provides are:

debugging the original C# code: DuoCode uses source mappings that should allow developers to see and step through the original C# code inside Visual Studio or the browser.

strongly-typed DOM and WebGL: this can be exemplified in the two examples below:

compilation speed: according to DuoCode, "most of the times, the compilation is even faster than the standard C# compilation of the same code."

support for Continuous Integration: DuoCode claims to be fully integrated with MSBuild and can be run as an MSBuild task, or as a command-line tool.

InfoQ has spoken to Stav Harel, manager of DuoCode launch.

Could you describe a few cases or scenarios where transpiling C# into JavaScript can be advantageous? What kind of customers do you have in mind?

Cross-compiling C# into JavaScript is very advantageous in allowing developers to use C# to develop JavaScript-HTML5 Web applications while enjoying the convenience of the C# language, Visual Studio, and debugging based on source-maps.

A few sample scenarios in which DuoCode can greatly benefit developers: Game development with WebGL; Server-side development with NodeJS; Building mobile applications with Cordova.

Moreover, it is the perfect solution for organizations that have already established their C# assets (projects and code, knowledge and experienced C# developers) to reuse their C# resources and efficiently develop JavaScript projects.

Could you provide some details about the way you use Roslyn and what benefits it brings?

DuoCode "understands" C# using the Roslyn compiler. Roslyn performs the code parsing, syntactic tree (AST) generation and contextual analysis. Then DuoCode takes over to perform the code translation and generates JavaScript code (along with source-maps) while completing language features that exist in C# and are missing in JavaScript.

Reliance on Roslyn has vital importance, as it allows DuoCode to keep up with latest technologies like C# 6.0 and Visual Studio 2015.

There are already a few transpilers from C# into JavaScript. What makes DuoCode unique in your view?

Several attempts to develop C#-to-JavaScript compilers have been introduced in the previous years, but they suffer from clear shortcomings.

Their support of C# is partial at best; their interoperability with existing JS libraries is insufficient; some of them produce a cumbersome code that is not readable (and looks like assembly code); some of them do not permit debugging in C#.

All existing solutions rely on old compilers and are maladapted to new features of Visual Studio 2015.

DuoCode is currently in closed beta. A request to join the program can be submitted from DuoCode web site.

Re: Sounds promising! I hope my beta invite arrives soon.

Your message is awaiting moderation. Thank you for participating in the discussion.

Thanks for your comment. Would you be nice enough to edit your profile and put in your real name? Although we haven’t published any restriction from using aliases, the intent for InfoQ discussions is to maintain a level of professionalism, in which using real names is an important factor. Thanks.