Charles

Luke Hoban: Latest version of F# Released - What's the story? What's next?

Download this episode

Download Video

Description

With the release of VS 2010 Beta 1 today, F# is officially a part of the in-box VS family in the sense that it ships with VS 2010 as a first class language for use in building your .NET projects that require the power and flexibility of the functional approach to program composition. For VS 2008, a great IDE and toolset that you have at your disposal today, you can install the equivalent version of F# that ships with VS2010 Beta 1 as an add-in install. Right on!

Here, F# Program Manager Luke Hoban talks with me about F#, generally and what people have been doing with it, the current state of the technology, what F# enables, etc. You'll even see some code Luke's written, but this is mainly an Old School Channel 9 conversation. You know the drill.

Enjoy.

Learn more:

Don Syme's announcement of the F# 2010 beta release: http://blogs.msdn.com/dsyme/archive/2009/05/20/visual-studio-2010-beta1-with-f-is-now-available-plus-matching-f-ctp-update-for-vs2008.aspx

The F# Dev Center: http://fsharp.net/

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • JoshRoss

      Congratulations on the release of Beta 1!  I have a question about Edit and Continue with F#, will it be supported with 2010?  If so, what are the tricky parts of getting it working, specificly working around immutability.

      And what happened to your blog?

    • aL_

      can f# functions be made available as c#/vb extension methods? that one feature would increase the usefulness of f# for the avarage .net programmer like ten times Smiley

      @35:00

      that c# code could have been made a lot more compact with a linq statement Smiley when written in linq the f# and c# versions wouldnt look all that diffrent imo Smiley

    • Charles

      But why would you do that when you can do it more naturally in F#? There are many things that you can do in C# that you can do in F#. In fact, Luke showed this over and over again when he was  C# program manager. This is part of why he was the natural choice to PM F#... I'd argue that you should use the right tool for the job at hand. If you simply want to use the power of monadic query comprehensions in C# (exposed as LINQ syntax), then use LINQ in your C# or VB.NET. If you want to program in a functional style and use less syntax to get the job done, then F# is the natural choice. The fact that F# is a .NET language means you can use it for constructing algorithms that it lends a very helping hand for at composition time and then use any number of other .NET languages that are better suited for other compositional tasks.

      C

    • aL_

      well, that perticular part of code may be more convenient to write in f# but if your whole project is a c# project, the convenience of a single method might not be worth it compared to the effort of creating and integrating a new project right? Smiley it all depends how much code like that you have..

      but thats not my point, my point was that this perticular c# code is not representative of what c# is capable of, i argue that a c# linq query is not hugely diffrent from the f# example shown. there are plenty of other examples where f# really do provide a compact bit of code that really isnt possible to write in c# (pattern matching for example), im just saying a scenario like that would make for a better example of the f# coolness Smiley

      beeing able to write f# extension methods usable from c# would be a really great enabler for doing just what your saying, using the right tool for the write job. surely you dont disagree with at part of my post? Smiley

    • Charles

      I'm not disagreeing. I'm simply asking questions. Smiley

    • aL_

      hehe ok Smiley

      i guess my awnser is that if most of my code is most easily written in c# but f# is more suitable for some parts, id make a c# project and pay the inconvecience of either integrating two projects or writing it all in c# Smiley

      but if i can write the f# suitable parts in f# and expose them as extension methods, i dont have to choose at all Big Smile

    • Charles

      What's wrong with writing a shared library for, say, computation-heavy tasks, in F# and then using it in a C# (or VB.NET or whatever.NET) project?

      C

    • Laurens

      I totally agree Smiley

      I currently try to make usefull F# examples for the company that I currently work for. I use C# for creating stuff like front-ends, main architecture, etc. And I build shared F# libraries to perform the actual computations/data processing in such a way that it easily plugs into the main architecture... (thanks to the excellent support for OO design and .NET in F# Smiley )

      I love F# because it allows me to focus on the complex problem that I want to solve, without being distracted by all the plumbing code in the background.

      p.s.: Thanks to all the people at C9 for all the excellent F# video's!

    • aL_

      nothing, i havent said that there is Smiley im just saying its a trade of with how much code we're talking about and how genericly applicable it is.. i mean you woudnt create a library just to be able to write one single specific method that is only used in one place in f#, espscially not if the penalty is of writing it in c# is so small. (comparing a c# linq statement with the equvalent f#). a generic library is another story Smiley

      and again, beeing able to create extension methods in f# doesnt contradict what you're saying at all, it further enables it Smiley [im still not clear on if thats possible or not]

    • JoshRoss

      The over use of these grimacing emoticons is rather disturbing.  Perhaps it is an indication of emotional distress, manic depression, or passive aggression.  If you have been diagnosed with bipolar disorder and your symptoms have returned or you are having any new symptoms please contact a medical professional.

    • aL_

      possebly Tongue Out or im just a part of the msn genereation who use emoticons as punctuation Wink if you got a problem with that, tough break Devil infact you seem alot more passive agressive than i Scared  perhaps you should go make sure there are no dang kids on your lawn Wink

      now if someone could just awnser my original question, the extension methods? Smiley

    • Charles

      Your original question implies the basic need to support multiple languages in a single project. A compiler would need to be able to compile multiple languages in one pass or the C# compiler would have to call out to the F# compiler. Now, if you had a compiler service that could communicate with other compiler services, well, who kows... You've not answered the question about how your approach is any better than simply building the functionality you need in F# in an F# library than use it in your C# project...

      What are you trying to accomplish by mixing languages?
      C

    • aL_

      what are you talking about? no it doesnt..

      extension methods are available across projects and across languages that supports them. are you saying that there are separate versions of Enumerable/Queryable for each language? thats not how it works.. extension methods are just static methods that have been marked as extension methods by their respective compiler. now my question was if there was a syntax for doing that in f# and by extension, if the f# compiler can find and use extension methods.

      i did awnser your question, i said that it depends on the situation and the code in question. putting a method like GetProductsWithPriceOver300 in a library just doesnt make sense, for that you use what ever language the rest of your project is in.  that however has absolutly nothing to do with my original post where i just pointed out that the c#/f# comparison in the video is not fair because the full capability of c# 3.0 wasnt used. had linq been used, the two code snipplets show would have been alot more similar.

      what am i trying to accomplish? i belive you call it "using the right tool for the task". extension methods greatly streamline this process.

      it actually turns out that you can [or at least were able to, again an update on the status of this would be great] create extension methods in f#. you do it with the "with" keyword in f# type declarations.. check out these links:

      http://cs.hubfs.net/forums/thread/3451.aspx

      http://blogs.msdn.com/dsyme/archive/2006/01/27/FSharpMeetsLinqOne.aspx

      http://codebetter.com/blogs/matthew.podwysocki/archive/2008/09/10/object-oriented-f-extension-everything.aspx

    • Charles

      I thought you asked if you would be able to create extension methods in F# in a C# project... In that case, my compiler perspective is correct. Guess we aren't communicating well Smiley

      C

    • aL_

      oh Smiley no i meant simply calling an extension method [as an extension method, not just a regular static method] written in f# from c#. Smiley

      to do what you describe i agree that your compiler prespective is correct Smiley it would be pretty cool to be able to do that though Wink

      sorry for beeing unclear, its 3 am here, maybe that's why Smiley

    • aL_

      after some more poking around i wasnt able to call my extension method written in a f# library from c# using the "with" keyword. however i found this:

      http://stackoverflow.com/questions/702256/f-extensions-in-c   [gotta love stackoverflow]

      where an attribute is used to mark extension methods as such. what is the relationship between[<System.Runtime.CompilerServices.Extension>] and the f# "with" keyword? ive read something about extension members in f# but such a member that happens to be a method doenst seem to be the same thing as a "c# extension method"

      again, more information on this would be really great Smiley

    • ni

      I'm trying to download the ctp update but the download links appear to be broken!

    • Charles
    • ni

      That's strange, it wasn't working a few hours ago, thanks anyway!

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.