Wednesday, 24 October 2012

The future of .NET lies in Mono. The future of F# lies in MonoDevelop.

F# 3.0 has recently been released, bundled in with the new all-grey, ALL-CAPS Visual Studio 2012. The biggest new feature is type providers, bringing some of the benefits of dynamic languages into type safe world. Innovations like type providers deserve more industry attention. I really hope these ideas will spread and hopefully languages like Scala will pick them up pretty soon so more developers (including me) can enjoy the benefits.

Take a look at ThoughWorks latest Tech Radar. F# distant relatives (as in fairly new "functional-first" languages) Scala and Clojure are steaming ahead and have both reached "Adopt" status. F# is stuck in "assess" never-land. I don't see many signs of that changing anytime soon.

F# has limited credibility because of Microsoft. Even though F# is actually open source, it has a very small open source community. The development is completely driven from Microsoft, and there is very little "open source buzz" about it, typical for any Microsoft products. F# moves with the same slow cadence as Visual Studio, which is software terms are eons between releases. Any big and open F# frameworks are sorely lacking. Microsoft's completely r******d (there, I said it) messaging regarding F# and .NET is also to blame.

On messaging; firstly, there is the total confusion about .NET. Where is that going? Windows8 is all about HTML5. Anders is doing Typescript now, silverlight is dead. There's a lot of frustrated .NET developer out there. I've predicted that Mono is future home and legacy for .NET, and it looks more likely every day. As a die-hard MSDN developer you might frown upon this fact, but really it's not a bad thing. Open-source and Mono has a lot to offer, for instance OS independence. This is absolutely critical to continue to drive adoption.

Secondly, F# has always been the odd one out in the .NET space (compared to headline technologies such as C#, VB, ASP). If Microsofts messaging on the future of .NET is confusing, their messaging on what F# is and supposed to be used for is crazy; "Use C# for everything, and if you're an academic do some data analysis check out F#". Screw that, F# is superior to C# in every single way, for any application. Microsoft should promote the hell out of it and stop pussyfooting about. However, I have very little faith that this will ever improve, and F# is (and always has been) dancing close to the edge of oblivion.

There is a big F# shaped hole in the language space currently, on the JVM and elsewhere. Like I stated a year ago, if F# did run on the JVM the story would be completely different, it would have massive adoption. It beats Scala on every single point, and is a perfect candidate for "the static typed language of choice" in your language toolbox. Today people are seriously looking into Haskell when they get fed up with their gnarly python/ruby projects. That's completely nuts if you ask me, I don't believe Haskell is the answer for any real-world problems, but let's keep that for a future blog post. F# should be what comes to mind first!

So what about Mono and open source then? Don Syme spoke at the recent MonkeySpace conference, and generated a lot of buzz. .NET has never been sexy technology in the hands of Microsoft, but the Xamarin guys are turning Mono into just that. MonoTouch, MonoGame, Unity are some really good products. Mr Don Syme, this is where you and your language belong, this is how you take F# to the next level. Forget about all the in-fighting and bickering at Microsoft and focus on what's good for F#. That is to embrace Mono fully, it's your number one platform.

The culture shift for developers who's been living inside the Microsoft/MSDN bubble moving to Mono is drastic. Mono is an all-out open source community with all it's up and downsides. Say goodbye to stable, supported releases every 3/4 years and hello to nightly builds and pull requests. That certainly won't fit all current .NET developers, like lemmings they'll just move along to whatever Microsoft is feeding them next. Could that be the native renaissance perhaps? :) Real .NET enthusiast should free themselves from the Microsoft shackles and embrace Mono, they'd be much better for it. Join the community, contribute improvements to the garbage collector. Go to awesome conferences in Boston, have fun!

To summarise, how do we save this gem of a language? F# must break out of the Microsoft prison. Ideally I'd like to see a couple of key members of the team to actually leave Microsoft, get some funding and set up a independent F# foundation (or maybe join Xamarin). This foundation could pursue important issues like sponsoring key libraries like web frameworks, making sure the F# MonoDevelop integration is top notch etc. So while Microsoft is committing corporate suicide with Windows8, the .NET and F# community needs to move on.

The future of .NET lies in Mono. The future of F# lies in MonoDevelop.

I think it's particularly important for .NET developers to embrace Mono and begin thinking like cross-platform developers. I also agree that both F# and .NET are downplayed in the Microsoft strategy and this is huge mistake. Xamarin has made all the right bets.

I am a .NET developer that has been feeling a bit left out by Microsoft. After writing a number of apps in WPF I fear that some day they're just simply going to drop support for it one day. I personally am no big fan of Windows 8 or 'Metro' or whatever they're calling it these days. More and more I have been looking into using Python for my web projects and abandoning the idea of desktop apps altogether. I don't even know what to do anymore. I would definitely use F# if it was on the JVM because I can use it on a Mac. I've switched recently from Windows because after using Windows 8 for a few weeks in development I realized that it's terrible and I wanted to get out ahead of it and use something more intuitive. I really like Windows 7 but 8 is terrible.

I really don't get the Win 8 is all about HTML 5 angle. I use C# to develop Win 8 apps just fine.

What MS did was also allow C++ and HTML/JavaScript to target Win8 New UI apps. There is no lack of support for existing .NET world, and only a fool would think they are likely to drop there most successful environment.

My only gripe is that the use of XAML from C++ is restricted to New UI app's, I'd use it for Desktop app's given half a chance.

The F# open source group (http://fsharp.github.com) is actively working on this. See http://fsharp.github.com/fsharpbinding for build/install. Pls add issues to github if it doesn't work for you and send those pull requests too.

Yea, for a short time. He's only doing it to increase developer productivity because he feels that static languages are better. He even said himself that he is still actively working on C# adding features to the next version.

I'm not sure where you got that he is only doing Typescript, because he isn't.

I fail to see how there is any confusion about C# (or VB.NET) for that matter. Just look at what MS has added to the languages of late - async for example. As well as what they are doing - check out Roslyn (compiler as a service). Also, for anyone concerned about WPF or Silverlight those may or may not continue from today but XAML isn't going anywhere and if you have invested time learning any of these your skills will be useful for a long time to come (Windows Phone anyone?).

I agree with wanting to promote OSS, especially F# (even if I don't use it). Mono is great and only getting better, but your arguments all sound like a bunch of FUD.

"WPF and Silverlight may or may not continue" - and, like, that doesn't create confusion? Get real.

Apart from the C# language itself the C# world is in total chaos. People are fleeing Microsoft's tools and platform at every opportunity. Anders only thinks about languages, and abandons ship when he gets to do another one.

This blog post was primarily about F#, trying to provoke some thought into how the language can get out of it's current stasis and grow it's userbase. I did sneak in some observations regarding .NET and it's current state and direction which quite possibly are exaggerated.

Mono is still an very important platform for .NET and F# in particular.

I think future of WPF and Silverlight is very bright. These technologies are revolutionary . See what amazing things can be done with these frameworks. Microsoft will never drop support for these as Application Programming arena will be dominated by these technologies.

This is a brilliant post, Martin. Thank you so much. This echoes so many voices I've heard and apparently resonated so much within Microsoft corporate that it was escalated to the higher ranks (!).

"Even though F# is actually open source, it has a very small open source community". Well, fsc compiles F# source code to CIL and is open source but .NET compiles CIL to machine code and it is closed source. I have heard talk of Microsoft open sourcing .NET, which would be a game changer.

"Like I stated a year ago, if F# did run on the JVM the story would be completely different, it would have massive adoption". We would certainly embrace it commercially.

"Say goodbye to stable, supported releases every 3/4 years and hello to nightly builds and pull requests". FWIW, when I was using Linux I found Debian's package system to be superbly maintained with a great self-consistent set of stable packages on offer that were up-to-date enough for my needs. The main problem we had with open source software was interoperability and anti-commerce attitudes.

"Ideally I'd like to see a couple of key members of the team to actually leave Microsoft, get some funding and set up a independent F# foundation (or maybe join Xamarin)". I've been asked (informally) if I would be interested in helping to found such a venture. I do think there is merit in the idea but my feeling is that we'd have to rewrite Mono's core, which is no easy task.

I do not agree that "F# beats Scala on every single point" and only somebody unfamiliar with either F# or Scala or both could say that. With very few exceptions on which Scala 2.10 closes the gap (e.g. quotations), I find the situation to be the exact opposite.

Scala, like F# and Clojure and unlike Haskell, was born within certain constraints from the get-go. However, unlike F# it worked with those constraints to produce something consistent and elegant, rather than hide the problems under the rug or add features that are not orthogonal.

First of all F# inherits some problems from Ocaml. Ocaml's type system is basically that of SML plus OOP. That's an over-simplification of course, but the underlying fact is that both F# and Ocaml have 2 type-systems in one language, just like some other languages that I hate, including C++, being an unholy union that doesn't make sense.

By contrast, in Scala everything is an object, including functions and every type is modeled by means of classes, including algebraic data-types, including type-classes. It's also good in the sense that Scala takes to heart the "universal access principle" (seeing you're into Clojure, you should understand the importance of it) ... as an example in Scala operators are defined as instance methods and so their behavior is polymorphic and there is no such thing as "static methods", while F# follows the C# convention where operators are static methods defined on the type in question - and the problem here is that those operators cannot be part of interfaces, you cannot make use of them in generic pieces of code where you may want to specify that this works on any type T that implements "+".

This is actually beautiful in the "*turtles all the way down*" sense and ultimately yields simplicity. In Scala OOP is not orthogonal to its functional features, but rather complementary.

F# does not have support for type-classes, or for multi-methods, or anything in between and while you can do certain tricks to achieve such an effect, like passing around a global virtual table, truth is F#'s ad-hoc polymorphic capabilities really suck. In F# implementing something akin to a collection that makes use of Ordering[T] for sorting, or CanBuildFrom[A, B, That], as the Scala collections are doing, is really hard, with some use-cases being impossible.

In contrast, Scala not only embraced OOP fully, but also extended it to be able of many of the same things you can do with type-classes in Haskell, by means of implicits. For Haskell to provide the things that Scala is able of it has to make use of experimental GHC extensions that are not part of the standard language (like existential types). The Scala collections library is among the best and most elegant collections library ever created for any language, being second to none.

Of course, every Haskell developer will tell you that Haskell's type system is more elegant and Scala, used as you would use Haskell, is a poor substitute. For instance Scala is only able of rank-1 polymorphism, while Haskell can work with rank-2 types. But Scala is a language that can stand on its own and idiomatic Scala does not necessarily resemble ML or Haskell code - as Scala can do a lot of crazy things at runtime, including "method_missing".

Thinking about Clojure - Clojure is only able to get away with multi-methods and protocols because it is dynamic. However if you want a language that can provide static safety, while having runtime dispatch (so basically something that sits in the middle of Clojure and Haskell), then OOP in combination with the means to do structural-typing and type-classes is the way to go and the solutions provided by Scala to the "expression problem" are simply superb.

Thanks Alexandru for a great answer (well worth a blog post in it's own right). The main focus of this post is about where F# is positioned and how it can move forward. I did sneak in some pot shots at Scala and Haskell which you rightly piked up on.

My comments are very subjective and based on my experience in F#, Scala and Haskell (I have undoubtedly spent most time in F# of the 3). I like Scala as well, it does lots of things right, but it's IMHO not as elegant as F#.

I don't think than f# is unpopular because is a .net language..it's unpopular because it has a small, lazy and no very friendly community (even if it hurts to hear)...I love fsharp as language, is clear, powerful and enjoyable..actually I prefer it over scala or clojure..but the community...well....

Take a look to fsharp tag in twitter: all twits are writes for less 10 guys and a bot...and I'm not exaggerating with it...now..if you look the tweets...about 80% are retweets or comments about "how good is f# over c#"..

now look the articles...all the articles writes in the latest year come from 10 blogs..maybe a bit more...these aren't oriented to new user and aren't very deep..except the amazing articles and contributions from tomas petricek (a really nice guy) and from dom for microsoft articles, the site fsharpforfunandprofit..all the other articles are really, really shorts and without enough information and content...

Tools in f#...maybe fake and a couple more...this is sad...

Now...I've used clojure (a small community but very diverse and prolific) and now I'm learning scala (which has people from ruby,java,haskell,f#,etc) the f# community is a bit flat..they thinking than the way for do f# popular is doing a type provider and one javascript compiler...??...personally I am not sure if this is the best way...

and yes..is cool than they have opened the fsharp foundation for no depend so much in .net...but this isn't being more than a web site with a couple of articles

this is how I see the f# evolution..maybe I'm wrong...I wish know if you see it in similar o different way...It's only my opinion...