F# 4.1 and Visual F# Tools for Visual Studio 2017
blogs.msdn.microsoft.com
blogs.msdn.microsoft.com
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:
* 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/
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?
(Unfortunately, the two modern languages - Go and Rust, despite showing so much promise, appear, from this perspective, to be following the wrong path.)
Go and Rust aren't "following the wrong path" IMHO but are great tools fit for purposes other than the ones Haskell or F# can excel at. The former are great for high-speed crunching, OS/network interops and transformations of massive volumes of say byte (more so than richly parsable text) formats, state machines, simple SIMD parallelism (where locks/mutexes etc aren't a major concern).. whereas the FPs excel at richer expressiveness for business domain models, workflow rule engines, of course also (and certainly even related) (e)DSLs and parsing / AST transformations+rewrites, propositions etc
JAHO (just another humble opinion). In the end they're all turing-complete so you "can" use any for anything
At the same time, I'm extremely skeptical of naming any single language the "programming language of the future". Application domains are simply too diverse for their problems to be solved adequately by any single language. On top of that, different people seem to think very differently: some have an easier time with a predominantly functional style, others get more mileage out of object-oriented programming (which again is completely alien to others) and so forth.
If there's one thing that I'm fairly certain of is that there's no such thing as a one-size-fits-all solution in the realm of programming languages and environments.
Of course they do, ownership is part of substructural type systems, more precisely affine types.
Several idiomatic functional programming techniques are similarly difficult to express with the additional invariants of affine types.
Being easy or hard is not what defines FP.
I've got nearly two decades worth of ML code lying around (mostly OCaml, some SML and F#) and for most of it rewriting it in Rust would require significant redesign for the reasons I mentioned. This starts with even very simple things like List.rev.
No, we are talking in the context of ATS, LinearML, Idris, Mercury, F* and a few others.
Remember that this is about the claim that "Rust is very much ML". It really isn't. It's a totally different programming paradigm. That's not bad. Rust does some things very well that ML has a hard time with. But it's not the same.
Rust is not ML but takes a lot of ideas from ML and functional languages, such as options, pattern matching, traits and "type classes" ...
Go is just bad feature wise for a language born after 2005. It's a good language for managers that don't trust their developers with their intelligence though, and will lead to a generation of developers who can only code in Go, because using anything else is "too complicated"...
I've argued that some minor updates to SML with actors/csp and a couple more primitive datatypes (esp unicode strings) would result in a language that is both easier and far more powerful than go.
By no means imperative languages will disappear, but I too share the opinion the future is bright for f#, elm, erlang etc.
Well F# might get it when Shapes gets into C# (C# version of traits/typeclasses which is being discussed)
You can easily do imperative programming in Haskell using IO. There are even lots of straightforward bindings to C libraries, directly exposing C functions. There are IORefs and so on.
Not sure about Scheme, usually lisps are quite imperative.
Hopefully ionide will support dotnet core soon now, and we can get a fully cross-platform development experience with VSCode and .Net Core.
Specifically, the following are in RC:
- FSharp.Core as a .NET Standard NuGet package
- The F# compiler running on .NET Core as a .NET Core console application
- F# support in the .NET CLI and the .NET Core SDK
However, the following are not supported at this time, but will be supported in a future Visual Studio 2017 update:
- F# support for .NET Core Visual Studio tooling
- F# Interactive (FSI) running on .NET Core as a .NET Core console application
Instead of complaining we, as a community, should be helping the VF# team and contributors with there efforts!
1. Xamarin[0]. It supports F# for everything aside from UWP targets.
2. WinForms on Mono[1].
3. FABLE[2] to compile your F# into JavaScript. It's a very good tool and it produces really nice JavaScript as well. From there, you can run the code on the web, Electron, or React Native[3].
[0]: https://developer.xamarin.com/guides/cross-platform/fsharp/f...
[1]: http://www.mono-project.com/docs/gui/winforms/
[2]: http://fable.io/