Microsoft Puts the F in Functional
MONTREALMicrosoft is putting the "F" in functional programming with its F# language.
F#pronounced "F sharp"is a functional programming language out of Microsoft Research that the company will productize to target developers dealing with concurrency and those in the financial, scientific and technical, and academic arenas.
At the Object-Oriented Programming, Systems, Languages and Applications 2007 conference here in October, some of Microsoft's leading language gurus, including Jim Hugunin, Anders Hejlsberg and Erik Meijer, spoke of coming to Montreal via Cambridge, England, where they had stopped in on Don Syme, Microsoft's researcher heading up the F# project. Microsoft had just announced plans to transition the technology from research to product form under Visual Studio.
Over dinner at the event, I had the chance to learn more about F# from Mads Torgersen, program manager for Microsoft's C#. Torgersen was instrumental in getting F# productized.
Earlier in the conference, Hejlsberg, a core creator of C#, said he has seen a resurgence of functional programming and its influences. Functional programming treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional languages include APL, Erlang, Haskell, Lisp, ML, Oz and Scheme. Microsoft's Meijer is one of the creators of Haskell.
"It's clear that a bunch of the things in programming that will be becoming more important over time benefit from a more functional style of programming, like concurrency, distributed programming and so forth," Torgersen said.
Microsoft snags an open-source project leader. Click here to read more.
Blogging on the issue, S. "Soma" Somasegar, corporate vice president of Microsoft's Developer Division, said, "Language features such as lambda expressions in C# and generics in .Net 2.0 have roots in functional languages, and LINQ [Language Integrated Query] is directly based on functional programming techniques."
Moreover, said Somasegar, many "ideas from functional languages are helping us address some of the biggest challenges facing the industry today, from the impedance mismatch between data and objects to the challenges of the multi-core and parallel computing space."
Also at the Montreal conference, Java creator and Sun Microsystems Fellow James Gosling said the issue he has with functional programming is that only a small segment of the community seems to be able to or has an interest in learning it.
Torgersen agreed that the functional languages around, "including Haskell, are very much in their own world. They tend to be very closed on themselves and do not interoperate well [with the rest of the world]. And that's a problem in a world that's increasingly dependent on APIs and having rich libraries and things to reach out to."
But that is the beauty of F#, in that Microsoft is building it as another language that will run on the company's CLR (Common Language Runtime).
"F# stems from the functional programming tradition [hence the 'f'] and has strong roots in the ML family of languages, though also draws from C#, LINQ and Haskell. F# is designed from the outset to be a first-class citizen on .Net," Somasegar said. "This means that F# runs on the CLR, embraces object-oriented programming, and has features to ensure a smooth integration with the .Net Framework."
Torgersen said F# is a "very pragmatic" adoption of functional programming. F# can address the needs of a group of programmers "that we've totally forgotten about in our whole traveling circus of object-oriented programming, which is people doing numerical stuff, scientific programming, technical programming and financial programmingthere are a bunch of folks with domain expertise but who have relatively limited tools they can program in," he said.
Moreover, Torgersen said F# encourages developers to program in a "stateless wayyou say what you want, but you don't say as much about how you want it. It's easier to abstract the how away. So that leaves you more wiggle room to define exactly how your code gets executed. You can separate the execution logic from the code intent, and that's useful when you want fine-grained control over how concurrency is handled."
He said F# is not being positioned as a successor to Visual Basic or C#. "We expect it to occupy a different market where we are very weak right now," he said.
Somasegar said Microsoft will fully integrate the F# language into Visual Studio and continue innovating and evolving F#. "In my mind, F# is another first-class programming language on the CLR," he said.
On his own blog, Syme said that Microsoft will be "initially focused on putting the finishing touches on [version 1] of the language design, improving the compiler, tools and Visual Studio project system, completing the language specification and augmenting F# with the libraries and tools needed to make it truly powerful in application areas particularly suited to functional programming."
In the meantime, Syme's group is hiring developers to beef up the F# team.
Check out eWEEK.com's