Open Source.NET

The IronLanguages Open Source Project

Late last year Microsoft took IronRuby, IronPython and the Dynamic Language Runtime projects open source. Here's a look at the open source dynamic language resources for Visual Studio.

With dynamically typed languages gaining momentum, we can’t help but see what options are available in the .NET ecosystem. Many may not know it, but we have open source implementations of Ruby and Python, along with integrations for Visual Studio, readily available.

The IronLanguages project started off as a six-year Microsoft endeavor to bring dynamic languages to the .NET platform. Late last year, Microsoft opened the source code and the community has taken over the project’s development. This includes IronRuby, IronPython and the Dynamic Language Runtime (DLR).

The DLR is is a set of services that sit on top of the Common Language Runtime (CLR) and provide the foundation for dynamically typed languages. Thus, the DLR enables IronRuby and IronPython to run on the .NET platform.

In addition to providing language services, the IronLanguages project also has IronStudio, a set of Visual Studio 2010 extensions with support for both IronRuby and IronPython. You can download the iron languages along with their tools for Visual Studio through their download pages on CodePlex (IronRuby Releases, IronPython Releases). Once installed, you can use Visual Studio to create a new project File | New | Project and select the language(s) that you installed.

The integrations provide a number of different project options. Take a look at the IronRuby projects and for now, we’ll select the Sinatra Web Application project. Sinatra is a popular Domain Specific Language (DSL) for quickly creating Web applications in Ruby. We can take advantage of Sinatra in IronRuby, giving us an elegant and simple way to create an IronRuby Web site.


[Click on image for larger view.]
Figure 1.IronRuby projects in Visual Studio.

As Visual Studio is creating your project, it will acquire the required gems and create a simple Sinatra Web application for you. Press F5 once the project is created, and you should see your Web app running in a browser. You will also notice a console window running along with your browser -- this is WEBrick. WEBrick is a Ruby library providing simple HTTP Web server services like Cassini (open source as well, distributed with Visual Studio) or IIS Express.


[Click on image for larger view.]
Figure 2.The Sinatra Web application code.


[Click on image for larger view.]
Figure 3.The Sinatra app displaying "Hello, World" in a browser.


[Click on image for larger view.]
Figure 4.The WEBrick console.

In addition to the many project types supplied by the Visual Studio integrations, you can also load interactive windows from View |Other Windows | IronRuby Interactive, and from View | Other Windows | IronPython Interactive. Very quickly we can open both interactive windows and implement a Fibonacci number generator in both languages.


[Click on image for larger view.]
Figure 5.IronRuby Interactive.


[Click on image for larger view.]
Figure 6.IronPython Interactive.

Outside of Visual Studio 2010, you can also open 32-bit and 64-bit consoles for IronRuby and IronPython, just as you would with their non DLR counterparts.

If you are thinking about creating Visual Studio 2010 extensions, I highly recommend looking through the IronStudio source code. There are a number of integrations implemented by the IronLanguages project and they can be a great source of information and examples.

IronStudio provides most of the development tools you would expect from a language service, including IntelliSense, debugging, syntax error detection, local window and more. IronStudio gives you a full .NET development environment with the flexibility of dynamic languages.

If you want to work on these projects, or have questions, you can go to the IronLanguages GitHub page or the mailing list and talk with other users and the developers.

Sites to Visit:
Iron Code Home: https://github.com/ironlanguages
IronPython Home: http://ironpython.net/
IronPython Download: http://ironpython.codeplex.com/releases
IronRuby Home: http://www.ironruby.net/
IronRuby Download: http://ironruby.codeplex.com/releases

About the Author

Ian Davis is the Master Code Ninja for software architecture and development consulting firm IntelliTechture. A C# MVP, Davis is an expert on the .NET Tramework and co-organizer of the Spokane .NET User Group who frequently speaks at industry events. He spends most of his free time as an open source author and advocate, publishing and working on many open source projects.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube