次の方法で共有


A Personal Review of F# by Adnan Osmani Microsoft Student Partner

When I first heard about F# - the new functional programming language from Microsoft, I thought it was going to be yet another deviation of Haskell. Haskell is one of those languages developers rarely use again once they’ve left University. However, having finally gotten around to using F#, I think some of you may be pleasantly surprised to see what it can offer.

Why F#
The problem with trying to solve a functional solution in a language like C# or C++ is that you’re often left handling a lot of different constructs – making it difficult for developers to properly model their problems. Haskell isn’t bad, but often simple exercises demand a lot from even the best of programmers.  F# differs from all of those by offering simple, yet efficient constructs – meaning that I can model whilst still having the benefits of C# and the .NET framework at my disposal.

Language Benefits

Internally, F# very closely resembles some of the traditional higher level functional languages out there. So why do I prefer it to Haskell?

• F# allows me to update variables later on in the development process – so its easier for me to treat it like a normal language
• It lets me focus on debugging my problem, rather than having to worry about trivial things like typed-formatting – one of the biggest problems with Haskell
• F# WinForms  allows me to create an easy interface for my F# code – the same thing can’t be said for our old friend Haskell

Those are only a few of it’s benefits, and I would already use F# over Haskell any day – like any functional language, it still allows me to focus on solving a problem through a math-like code structure, but doesn’t give you anywhere near as much stress as Haskell!.

What else makes F# different

Outside of the core language, F# allows you to code parts of your application in an existing .NET language like C#. This allows you for the first time ever to merge a functional and standard programming language without needing to use any third party interfaces. You can also easily convert between F and C# without too much hassle, and even more importantly, we’re provided with near complete access to all of the .NET libraries, like DirectX and Quartz.
Shortcomings
The official F# team claim that it’s meant to “bridge the best of the functional, imperative, object-oriented and typed-classed languages” – from what I’ve seen it’s well on its way to achieving that, but its not quite there yet. Object support could be improved, as well as proper integration into Visual Studio.
As F# is partially based on C# and OCaml, it’s difficult to classify it. It’s not a complete functional language, nor a standard development environment, so some developers might want to see more widespread usage before diving into yet another programming language.
Final words
For the moment, only the most enthusiastic functional programmers are jumping into the F# boat. If you’re ready to join them, make sure you bring a life jacket, because it looks like it may be a bumpy ride before F# makes it’s mark on the development world – but I think it may just happen.

Watch this space!.

To get started using F#, head over to Microsoft.com/Research.

Comments

  • Anonymous
    April 04, 2006
    What kind of credibility can have someone who can't even set the COLOURS of his page RIGHT? <g>
  • Anonymous
    April 05, 2006
    The comment has been removed
  • Anonymous
    May 06, 2006
    ...i didnt set the colors on this page lol - the article was written for the StudentZine and apparently ended up here too ;)