I do have a small question about the Visual F# team at Microsoft. Are there any plans to grow the team at all? It seems that the company deems F# as a second class .Net language, preferring VB.Net/C# when it comes to contributions from employees and IDE features. Given the popularity of F# in surveys such as the recent annual Stack Overflow developers survey, is there any interest at the company to put more manpower to F# development?
P.S. I hope to see you around at the F# Exchange in London next month if I go.
By sitting the F# language service atop Roslyn Workspaces, F# in Visual Studio is in a far better place infrastructure-wise than it has ever been. Roslyn Workspaces are the lower-level piece that nearly every bit of .NET IDE work is done in.
A great example of how that enables F# in other areas is how the idea of support for the Roslyn Project System[0] went from a complete unknown to a reality. The work needed to support F# in various areas went down by orders of magnitude as a result of this work.
[0]: https://github.com/dotnet/roslyn-project-system/pull/1670
P.S. I'll be in London for a week. Even if you can't make F# Exchange, I'd love to meet up for coffee, beer, or whatever!
https://blogs.msdn.microsoft.com/dotnet/2017/02/01/the-net-l...
But I wouldn't judge too much based on team size - the Visual Studio Code team is very small, and yet has an incredible velocity and quality.
One more question. I work at a place with a very restrictive firewall. F# 3 projects worked fine, but with F# 4 the build fails to download nuget packages. Is there a way to use the latest version without Internet connection? I can download anything from microsoft.com, as that site is whitelisted, but nuget.org is not.
Yes! F# is perfectly suitable for OO code, and supports all the same features that C# and VB do, plus Object Expressions, which are a really cool way to implement an interface in an ad-hoc way.
You can learn more here: https://fsharpforfunandprofit.com/series/object-oriented-pro...
Lots of folks in the F# community would encourage you to adopt a functional pattern (as I would as well), but since so much mindshare in the world is currently surrounding object orientation, I think it's great to use F# for OO code and slowly start to sneak in functional patterns. F# is a very "clean" language in that regard.
> One more question. I work at a place with a very restrictive firewall. F# 3 projects worked fine, but with F# 4 the build fails to download nuget packages. Is there a way to use the latest version without Internet connection? I can download anything from microsoft.com, as that site is whitelisted, but nuget.org is not.
Hmmmm. You should be able to build F# 4.1 projects in VS 2017 without an internet connection, but it currently does take a dependency on System.ValueTuple to support struct tuples. This is a point-in-time problem that C# shares as well, because System.ValueTuple is not in the .NET Framework yet. It will be in a future .NET Framework release. This shouldn't limit you, though - you can still do anything in-box, just without using struct tuples.
Naturally, anything involving NuGet packages will be off-limits in your case. So that does cut you off from some of the awesome community packages out there. Have you considered hosting an internal NuGet feed with a package cache so that you're not limited in this way? A lot of companies do this.
My understanding is that while F# indeed supports almost all OOP paradigms nevertheless partial classes are not supported in F#. Do I miss something?
This sounds like a horrible environment to work in. If you don't trust your developers to make those kind of decisions for themselves then what are you even paying them for? That gives them no ability to exercise their skills and I would not expect any good developer to stay long in such a place.
Frankly it suggests a level of brokenness in your process that I've always found unfixable. I'd advise finding a better job.
It's probably possible to convince me that the limitation on circular references is actually a feature, but implicit interfaces would be really nice to have.
If I ever dive back into to F#, I think I will treat it as "procedural first with a neat type system" and limit the use of both OO and functional features to where they markedly improve the code.
This may be a good strategy; I would urge you though to try doing top-down design in F# using modules and interface (.fsi) files. E.g., let's design a calculator GUI app in F# using, say, Windows Forms. Sketch out the interface first:
(* Calculator.fsi *)
namespace CalculatorApp
module Calculator =
type number = Zero | One | Two | ... | Nine
type op = Plus | Minus | ... | Sqrt
(*
Holds the app model. Note that it is mutable; the keypress operations
return `unit`, i.e. they update the `t` value in place.
*)
type t
val init : t
val press_number : t -> number -> unit
val press_op : t -> op -> unit
val calculate : t -> double
(*
Draws the app and hooks up event handlers to the above operations.
*)
val render : unit -> System.Windows.Forms.Control
Then in the implementation file (Calculator.fs), fill in the blanks based on the types! Of course you'll need a separate file for the main entry point, but that's good practice anyway.Have that in Haskell as well. As the community largely views FP as "type-driven development" and Haskell as a "typeful language", it isn't uncommon to have a single module just for listing all the Algebraic Data Types (not their "methods" though, that's more an OOP concept anyway). Having all ADTs at a glance has its own benefits in terms of "high-level overview" etc too of course.
But of course the question was about OOP so you're right calling this a "caveat" in that respect.
You can write object oriented code, but functional code looks so much better.
By the way, the strategy patter translates very well to functional programming. Just pass a function with the behaviour you want!
I love the language but have not followed it closely in a while - what's the current story on compiling F# to native applications?
Edit: Just to reiterate, the releases described in the blog post have an immense amount of community sweat behind them. We're super happy about how engaged the F# community is and proud to have such a long section dedicated to attribution.
If you want to learn more about F# or get started, try any of the following:
* http://fsharp.org/
* https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tuto...
* https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tuto...
* https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tuto...
* Visual Studio for Mac (comes with F#): https://www.visualstudio.com/vs/visual-studio-mac/