Scott Dorman

ephemeral segment

  Home  |   Contact  |   Syndication    |   Login
  608 Posts | 11 Stories | 902 Comments | 51 Trackbacks

News


Post Categories

Image Galleries


Microsoft Store


Creative Commons License



Locations of visitors to this page

Subscribers to this feed

TwitterCounter for @sdorman

View blog authority

Add to Technorati Favorites

Windows Live Alerts

AddThis Social Bookmark Button

LinkedIn profile

Community Credit profile

The Code Project

Follow me on Twitter

Get Free Shots from Snap.com

Community Credit Hall of Fame

Get Feedghost

Xobni outlook add-in for your inbox



Support This Site

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Over the years .NET has been a great platform for multiple languages, and actually launched with support for 16 different languages. Up until recently, however, it has been difficult (but not impossible) to create functional and dynamic languages for .NET.

With the release of CLR 4.0, Microsoft is officially releasing IronPython, IronRuby, F#, and several other functional or dynamic languages. In order to do this, the CLR is gaining support for a few language features that are common in these types of languages, specifically support for:

  • Big Integers
  • Tuples
  • Tail Recursion

Big Integer support was a request from both the F# and Python languages and was co-implemented with the Microsoft Optima team. (This is the team that works on the Microsoft Solver Foundation, which is a brand new framework and managed code runtime for mathematical programming, modeling, and optimization.)

Tuples were also a request from both the F# and Python languages and provide the ability to create classes on the fly. The real benefit, especially to C# and VB developers is that now there is a built-in data type which will allow multiple return values.

public Tuple<Int32, Int32> DivAndRemainder(Int32 i, Int32 j) 
{
    return new Tuple.Create(i/j, i%j);
}   // Accessing items in a tuple.  
for (Int16 i = 0; i <= 25; i++)
{
    for (Int16 j = 1; j <= 5; j++) 
    {
        var tuple = DivAndRemainder(i,j);
        Console.WriteLine("{0}\t{1}\t{2}\t{3}\n", i, j, tuple.item1, tuple.item2);
    }
}

Tuples are implemented as a generic class, in a very similar fashion to the Func<T> and Action<T> classes. C# and VB.NET don’t get the same syntax support in the language (in F# or Python you create a tuple with syntax like (4, “Hello World”) which is very concise), but this is almost as easy (and there may possibly be some syntax support in C# 5.0).

Also requested by the F# team is support for tail recursion. Tail recursion is relatively rare in C# and other procedural languages so this is more important for the functional languages that will be supported.

Technorati Tags: ,
Digg This
posted on Monday, November 10, 2008 10:26 AM

Feedback

# re: CLR 4.0: Managed Languages 12/10/2009 1:16 AM Ulrich Grude
Informative, to the point, short, that is what I like about this article about Managed Languages.

Post A Comment
Title:
Name:
Email:
Comment:
Verification: