InfoQ

News

Is C# becoming a functional language?

Posted by Jonathan Allen on Jan 26, 2007

Community
.NET
Topics
.NET Framework
Tags
C# ,
Visual Basic.NET ,
LINQ ,
Functional Programming

With the extensive functionality added to support LINQ, many people have been asking if C# and VB are becoming functional languages. Mads Torgersen, C# Language PM, answers this question in his article by the same name.

The first area he addresses is expression-orientated constructors. By allowing any property to be set in the constructor, developers can easily compose nested constructors. Currently the class's author has to guess which properties the developer may want to set during initialization, and without optional parameters, these lists could become quite long.

The next area is value-based programming, an area that Mads admits C# is still weak in. While writing immutable types is possible, there is some overhead such as manually overloading the hash code and equality operators.

With anonymous types, C# and VB get one-step closer to true dynamic typing. They are not there yet, but at least you do not have to create so many trivial classes.

Pattern matching and tuples are two more areas that you will not be seeing in C# any time soon. You will however see extended support for C#'s anonymous functions and lambda expressions. There is even a way to curry functions, though as Mads says, "it ain’t pretty".

Finally, C# will support type inference. Besides making anonymous types possible, type inference can significantly reduce the amount of redundant code a developer has to write. This is one reason why dynamic typing has been praised so much recently. But unlike true dynamic typing, the compiler still outputs statically checked early bound code.

leading over java by Joost de Vries Posted Jan 26, 2007 11:56 AM
Re: leading over java by Jonathan Allen Posted Jan 26, 2007 2:12 PM
Thoughts about Java, C# future and functional relationships by Dominique De Vito Posted Jan 28, 2007 3:10 AM
  1. Back to top

    leading over java

    Jan 26, 2007 11:56 AM by Joost de Vries

    As a java developer I have to say; c# is leading the way.
    Hopefully java will follow.

    I never realized that Microsofts interest in functional programming is tied to the usefulness of functional programming in parrallel programming. The multicores are coming...

  2. Back to top

    Re: leading over java

    Jan 26, 2007 2:12 PM by Jonathan Allen

    If you really want to see where Microsoft is going with all this, take a look at PLINQ. PLINQ talk at DAMP

    You can also watch for more PLINQ articles from InfoQ at www.infoq.com/PLINQ/.

  3. I have tried in 2005 to sketch here the overall move of Java, C#, their future and the relationships with functional languages. This sketch is still online with reality. It give also hints about multi-core perspective and the Java/C# move to functional languages.

    And into another post, more ramblings on programming languages, I have tried too to give more thoughts about this move, and reasons why such "exotic" languages, like functional languages, have NO intrinsic performance problems.

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.